home *** CD-ROM | disk | FTP | other *** search
/ Megahits 7 / Megahits 7 (1995)(GTI - Rhein-Main-Soft)(DE)[!].iso / franz / franz_101_150 / franz_130.dms / franz_130.adf / PLTTools / PLTMore / PLTMore+.asm < prev    next >
Assembly Source File  |  1991-06-22  |  61KB  |  2,770 lines

  1.  
  2. ; ***********************************************************
  3. ; *                                                         *
  4. ; *    P L A T I N U M - M O R E - R E P L A C E M E N T    *
  5. ; *                                                         *
  6. ; *        P L U S  (File-Requester)  V E R S I O N         *
  7. ; *                                                         *
  8. ; *                        V 2.00                           *
  9. ; *                                                         *
  10. ; ***********************************************************
  11. ; *                                                         *
  12. ; *          Assembler-Source / Assembler: Devpac II        *
  13. ; *                                                         *
  14. ; *                    (C)March 1991 by                     *
  15. ; *                                                         *
  16. ; *                    Joerg Schliesser                     *
  17. ; *                  Platinum-Softwareline                  *
  18. ; *                   Rotenwaldstrasse 20                   *
  19. ; *                   D-7000 Stuttgart 1                    *
  20. ; *                         Germany                         *
  21. ; *                                                         *
  22. ; ***********************************************************
  23.  
  24. ; *** Amiga OS-Routinen ***
  25.  
  26.     ; Exec-Library
  27. AllocMem    =    -198
  28. FreeMem        =    -210
  29. FindTask    =    -294
  30. GetMsg        =    -372
  31. ReplyMsg    =    -378
  32. WaitPort    =    -384
  33. CloseLibrary    =    -414
  34. OpenLibrary    =    -552
  35.  
  36.     ; Dos-Library
  37. Open        =    -30
  38. Close        =    -36
  39. Read        =    -42
  40. Write        =    -48
  41. Lock        =    -84
  42. UnLock        =    -90
  43. DupLock        =    -96
  44. Examine        =    -102
  45. ExNext        =    -108
  46. CurrentDir    =    -126
  47. ParentDir    =    -210
  48.  
  49.     ; Intuition-Library
  50. AddGadget    =    -42
  51. ClearPointer    =    -60
  52. CloseWindow    =    -72
  53. DrawImage    =    -114
  54. OpenWindow    =    -204
  55. PrintIText    =    -216
  56. RefreshGadgets    =    -222
  57. RemoveGadget    =    -228
  58. SetPointer    =    -270
  59. AutoRequest    =    -348
  60.  
  61.     ; Graphics-Library
  62. MovePen        =    -240
  63. Draw        =    -246
  64. RectFill    =    -306
  65. WritePixel    =    -324
  66. SetAPen        =    -342
  67. ScrollRaster    =    -396
  68.  
  69.     ; Konstanten
  70. execbase    =    $4
  71.  
  72. ; assembler-options
  73.  
  74.     section    programm,code    ;one section, code, public_mem
  75.  
  76. ; check WB- or CLI-start and get  WB-startup-message
  77.  
  78. start:
  79.     move.l    sp,startsp    ;save stackpointer 
  80.     move.l    a0,memo1    ;cli textpointer
  81.     move.w    d0,memo2    ;cli textlength
  82.     move.l    4,a6
  83.     suba.l    a1,a1        ;get adress of PLTMore-Task
  84.     jsr    FindTask(a6)
  85.     move.l    d0,thistask
  86.  
  87.     lea    dosname,a1
  88.     moveq    #0,d0
  89.     jsr    OpenLibrary(a6)        ;open dos_lib
  90.     move.l    d0,dosbase
  91.     beq    quitpltmore
  92.  
  93.     lea    graphname,a1
  94.     moveq    #0,d0
  95.     jsr    OpenLibrary(a6)        ;open graph_lib
  96.     move.l    d0,graphbase
  97.     beq    quitpltmore
  98.  
  99.     lea    intuiname,a1
  100.     moveq    #0,d0
  101.     jsr    OpenLibrary(a6)        ;open intui_lib
  102.     move.l    d0,intuibase
  103.     beq    quitpltmore
  104.  
  105.     move.l    #44000,d0
  106.     move.l    #$10001,d1
  107.     jsr    AllocMem(a6)        ;get diskmem (for filenames)
  108.     move.l    d0,diskmem
  109.     beq    quitpltmore
  110.  
  111.     move.l    #1024,d0
  112.     move.l    #$10003,d1
  113.     jsr    AllocMem(a6)        ;get infomem (for fileinfos)
  114.     move.l    d0,infomem
  115.     beq    quitpltmore
  116.  
  117.     move.l    graphbase,a0    ;get vertical standart resolution
  118.     move.w    216(a0),wplt+6    ;for opening window with max-size
  119.  
  120.     move.l    thistask,a4    ;pointer to task struct
  121.     tst.l    $ac(a4)        ;started from CLI ?
  122.     beq    wbstart
  123.  
  124. ; get filename if started from CLI
  125.  
  126.     move.l    memo1,a0    ;text-pointer
  127.     move.w    memo2,d0    ;text-length
  128.     subq.w  #1,d0        ;no text ?
  129.     beq    nofile        ;well then ... waiting
  130. lforname:
  131.     cmpi.b    #$20,(a0)+    ;look for 'space'
  132.     bne    foundname    ;no space ... got beginning of filename
  133.     dbra    d0,lforname
  134.     bra    nofile        ;no space ... no filename !
  135. foundname:
  136.     subq.l    #1,a0        ;got filename
  137. getfilename:
  138.     lea    filename,a1    ;adress of memory for filename
  139.     cmp.b    #34,(a0)    ;drop " - char at the beginning
  140.     beq    dropfirst
  141.     cmp.b    #39,(a0)    ;drop ' - char at the beginning
  142.     bne    copyname
  143. dropfirst:
  144.     adda.l    #1,a0
  145. copyname:            ;copy filename
  146.     move.b    (a0)+,d1
  147.     beq    eofname        ;zero => end
  148.     cmp.b    #10,d1
  149.     beq    eofname        ;linefeed => end
  150.     cmp.b    #13,d1
  151.     beq    eofname        ;carriag return => end
  152.     move.b    d1,(a1)+
  153.     bra    copyname
  154. eofname:
  155.     clr.b    (a1)        ;zero-byte to end filename
  156.     cmp.b    #34,-(a1)    ;drop " - char at the end
  157.     beq    droplast
  158.     cmp.b    #39,(a1)    ;drop ' - char at the end
  159.     bne    gotfilename
  160. droplast:
  161.     clr.b    (a1)
  162.     bra    gotfilename
  163.  
  164. ; get parameters if programm is started from wb
  165.  
  166. wbstart:
  167.     lea    $5c(a4),a0    ;pointer to task's message-port 
  168.     jsr    Waitport(a6)    ;wait for wb-start-message
  169.     lea    $5c(a4),a0
  170.     jsr    GetMsg(a6)    ;get wb-start-message
  171.     move.l    d0,startmsg
  172.     beq    nofile        ;no message ? ... strange !
  173.     move.l    d0,a0
  174.     cmp.l    #1,$1c(a0)    ;number of arguments < 1 ... nofilename
  175.     bls    nofile
  176.     move.l    $24(a0),a2    ;pointer to list of segments (picked icons)
  177.     beq    nofile        ;... very strange !
  178.     move.l    8(a2),d1    ;pointer to directory of text(?)-icon
  179.     beq    noselectdir
  180.     move.l    dosbase,a6
  181.     jsr    CurrentDir(a6)    ;actual dir => new dir
  182.     move.l    d0,d1
  183.     beq    noselectdir
  184.     jsr    UnLock(a6)
  185. noselectdir:
  186.     move.l    12(a2),d0    ;pointer to filename
  187.     beq    nofile        ;... no filename !
  188.     move.l    d0,a0
  189.     tst.b    (a0)        ;get first character of filename
  190.     beq    nofile        ;... still very strange !
  191.     bra    getfilename    ;well then get the filename
  192.  
  193. ; well ... now we open the window !
  194.  
  195. nofile:
  196.     bset    #0,pltflag
  197. gotfilename:
  198.     move.l    intuibase,a6
  199.     lea    wplt,a0        ;open display-window
  200.     jsr    OpenWindow(a6)
  201.     move.l    d0,wdwhandle    ;keep wdwhandle
  202.     bne    gotpltwdw    ;one window ! ... that's unbeliveable
  203.     move.w    #200,wplt+6    ;if opening the window failed, try to
  204.     btst    #3,pltflag    ;open one with 200 lines, but if the
  205.     bne    quitpltmore    ;2nd try failed too, then quit 
  206.     bset    #3,pltflag    ;the programm ... sorry !
  207.     bra    gotfilename
  208. gotpltwdw:
  209.     move.l    d0,a0
  210.     move.l    50(a0),wdwrast    ;keep rastport
  211.     bsr    dowindow    ;draw the wonderful pltmore-window
  212.     btst    #0,pltflag
  213.     bne    loadrequest    ;did we get one file to start ?
  214.  
  215. ; now we load our text (?) - file
  216.  
  217. gotloadfile:
  218.     bsr    pltworkon
  219.     lea    filename,a0    ;filename-pointer
  220.     move.l    #$10001,d0    ;type of memory: public/clear
  221.     bsr    loadfile    ;one file-load-routine
  222.     move.l    d0,memlong    ;keep length of data
  223.     beq    loadferror    ;data length = 0 ... really very strange !
  224.     move.l    a0,membase    ;data-adress-pointer
  225.     clr.w    linecount    ;clear line-counter
  226.     bclr    #7,pltflag    ;clear flag for scanning page
  227.     bra    scanpage    ;get adresses of lines
  228.  
  229. ; we scann the text and print it on the screen !
  230.  
  231. newshowpage:
  232.     bsr    scantabs    ;get the possible tab positions
  233.     bsr    dowindow    ;redraw window (necessary in case of newsize)
  234.     bsr    scanlength    ;get length of page
  235.     bsr    showpage    ;show one whole page
  236.     bset    #6,pltflag
  237.  
  238. ; waiting for some user-request
  239.  
  240. loadferror:
  241.     bsr    pltworkoff
  242. waitmessage:
  243.     move.l    4,a6
  244.     move.l    wdwhandle,a0
  245.     move.l    86(a0),a0    ;window-user-port
  246.     jsr    WaitPort(a6)    ;waiting for intuimessage
  247.     move.l    wdwhandle,a0
  248.     move.l    86(a0),a0    ;window user-port
  249.     jsr    GetMsg(a6)    ;get intuimessage
  250.     tst.l    d0
  251.     beq    waitmessage    ;there wasn't one ... stra...
  252.     move.l    d0,a1
  253.     move.l    20(a1),d6    ;get idcmp-code of event
  254.     move.l    28(a1),a3    ;get (possibly) adress of gadget
  255.     move.w    24(a1),d5    ;get (possibly) raw-key-code    
  256.     move.w    26(a1),d4    ;get (possibly) qualifier
  257.     jsr    ReplyMsg(a6)    ;and reply message
  258.     cmp.l    #$4,d6        
  259.     bne    norefreshmsg    ;if there was a refresh-request
  260.     btst    #6,pltflag
  261.     bne    waitmessage
  262.     bra    newshowpage    ;we have to redraw the window
  263. norefreshmsg:
  264.     bclr    #6,pltflag
  265.     cmp.l    #$2,d6
  266.     bne    nosizemsg    ;if the window was sized
  267.     move.w    lines,d0    ;get the total number of lines
  268.     subq.w    #1,d0
  269.     move.w    d0,maxline
  270.     bsr    scanlength    ;get length of new display
  271.     move.w    pagelength,d0    ;and get the number of the first line 
  272.     sub.w    d0,maxline    ;of the last display-page
  273.     bpl    newshowpage
  274.     clr.w    maxline
  275.     bra    newshowpage    ;and redraw the window
  276. nosizemsg:
  277.     cmp.l    #$40,d6
  278.     bne    noupgadgetmsg    ;wasn't any gadget at all
  279.     cmpa.l    #gdgspcup,a3
  280.     beq    upspacetab    ;request for more spaces per tab
  281.     cmpa.l    #gdgprint,a3
  282.     beq    printtext    ;request for printing text
  283.     cmpa.l    #gdgspcdn,a3
  284.     beq    dnspacetab    ;request for less spaces per tab
  285.     cmpa.l    #gdgexit,a3    ;user selected exit-gadget ??
  286.     beq    quitpltmore    ;well ... may he/her be damned !
  287.     cmpa.l    #gdgprevpage,a3    ;request for previous page ?
  288.     beq    showprevpage
  289.     cmpa.l    #gdgprevline,a3    ;request for previous line ?
  290.     beq    showprevline
  291.     cmpa.l    #gdgnextline,a3    ;request for next line ?
  292.     beq    shownextline
  293.     cmpa.l    #gdgnextpage,a3    ;request for next page ?
  294.     beq    shownextpage
  295.     cmpa.l    #gdgboftext,a3    ;request for first page ?
  296.     beq    firstpage
  297.     cmpa.l    #gdgeoftext,a3    ;request for last page ?
  298.     beq    lastpage
  299.     cmpa.l    #gdgsearchnext,a3    ;request for next entry to search ?
  300.     beq    searchnext
  301.     cmpa.l    #gdgsearchprev,a3    ;request for previous entry to search ?
  302.     beq    searchprev
  303.     cmpa.l    #gdgloadfile,a3    ;request for new file to load ?
  304.     bne    noloadtext
  305. loadrequest:
  306.     bsr    filerequest
  307.     tst.l    d0
  308.     beq    waitmessage
  309.     bra    loadtextfile
  310. noloadtext:
  311.     cmpa.l    #gdghelp,a3    ;request for help-window ?
  312.     bne    waitmessage
  313.     bsr    plthelp        ;draw the help-window
  314.     bra    waitmessage
  315. noupgadgetmsg:
  316.     btst    #0,d4
  317.     bne    shifted        ;was any shift-key pressed too ?
  318.     btst    #1,d4
  319.     bne    shifted
  320.     cmp.w    #$45,d5
  321.     beq    quitpltmore    ;'esc' - quit programm ?
  322.     cmp.w    #$3f,d5
  323.     beq    showprevpage    ;'9 / PgUp' - previous page ?
  324.     cmp.w    #$4c,d5
  325.     beq    showprevline    ;'CRSR UP' - previous line ?
  326.     cmp.w    #$3e,d5
  327.     beq    showprevline    ;'8 / up' - previous line ?
  328.     cmp.w    #$4d,d5
  329.     beq    shownextline    ;'CRSR DN' - next line ?
  330.     cmp.w    #$1e,d5
  331.     beq    shownextline    ;'2 / dn' - next line ?
  332.     cmp.w    #$1f,d5
  333.     beq    shownextpage    ;'3 / PgDn' - next page ?
  334.     cmp.w    #$3d,d5
  335.     beq    firstpage    ;'7 / Home' - first page ?
  336.     cmp.w    #$1d,d5
  337.     beq    lastpage    ;'1 / End' - last page ?
  338.     cmp.w    #$5f,d5
  339.     bne    waitmessage
  340.     bsr    plthelp        ;'Help' - show help window
  341.     bra    waitmessage
  342. shifted:
  343.     cmp.w    #$4c,d5
  344.     beq    showprevpage    ;'CRSR UP' - previous page ?
  345.     cmp.w    #$4d,d5
  346.     beq    shownextpage    ;'CRSR DN' - next page ?
  347.     cmp.w    #$36,d5
  348.     beq    searchnext    ;'N' - search next
  349.     cmp.w    #$19,d5
  350.     beq    searchprev    ;'P' - search previous
  351.     cmp.w    #$28,d5
  352.     beq    loadrequest    ;'L' - load textfile
  353.     cmp.w    #$1b,d5
  354.     beq    upspacetab    ;'+' - add one space
  355.     cmp.w    #$3a,d5
  356.     beq    dnspacetab    ;'-' - sub one space
  357.     cmp.w    #$0b,d5
  358.     beq    dnspacetab    ;'ß' ('-' on US-keymap) - sub one space
  359.     cmp.b    #$0c,d5
  360.     beq    upspacetab    ;''' ('+' on US-keymap) - add one space
  361.     bra    waitmessage
  362.  
  363. ; load one new text-file
  364.  
  365. loadtextfile:
  366.     move.l    4,a6
  367.     move.l    membase,a1
  368.     move.l    memlong,d0
  369.     beq    nooldfilemem
  370.     jsr    FreeMem(a6)    ;free old data memory
  371.     clr.l    memlong
  372. nooldfilemem:
  373.     move.l    linemem,a1
  374.     moveq    #0,d0
  375.     move.w    lines,d0    ;free old data for line-adresses
  376.     beq    nooldlinemem
  377.     asl.l    #2,d0
  378.     jsr    FreeMem(a6)
  379.     clr.w    lines
  380. nooldlinemem:
  381.     bsr    cleardisplay    ;clear the display
  382.     bra    gotloadfile
  383.  
  384. ; clear text-display
  385.  
  386. cleardisplay:
  387.     move.l    graphbase,a6
  388.     move.l    wdwrast,a1
  389.     moveq    #0,d0
  390.     jsr    SetAPen(a6)    ;set actual pen to background-color
  391.     move.l    wdwhandle,a2
  392.     move.l    wdwrast,a1
  393.     moveq    #4,d0
  394.     moveq    #32,d1
  395.     move.w    8(a2),d2
  396.     subq.w    #4,d2
  397.     move.w    10(a2),d3    ;clear text-display
  398.     sub.w    #9,d3
  399.     jsr    RectFill(a6)
  400.     move.l    wdwrast,a1
  401.     moveq    #4,d0
  402.     move.w    10(a2),d1
  403.     sub.w    #9,d1
  404.     move.w    8(a2),d2
  405.     sub.w    #16,d2
  406.     move.w    10(a2),d3    ;clear bottom of text-display
  407.     subq.w    #2,d3
  408.     jsr    RectFill(a6)
  409.     rts
  410.  
  411. ; quit this wonderfull program ...
  412.  
  413. quitpltmore:
  414.     tst.l    startmsg
  415.     beq    nousinglock
  416.     move.l    dosbase,a6    ;unlock used lock, if PLTMore was
  417.     move.l    uselock,d1    ;started from the workbench
  418.     beq    nousinglock
  419.     jsr    UnLock(a6)
  420. nousinglock:
  421.     move.l    intuibase,a6
  422.     tst.l    wdwhandle
  423.     beq    nowdwclose    ;close PLTMore-window
  424.     move.l    wdwhandle,a0
  425.     jsr    CloseWindow(a6)
  426. nowdwclose:    
  427.     move.l    4,a6
  428.     tst.w    lines
  429.     beq    nolinememclear
  430.     move.l    linemem,a1    ;free memory for line-adresses
  431.     moveq    #0,d0
  432.     move.w    lines,d0
  433.     asl.l    #2,d0
  434.     jsr    FreeMem(a6)
  435. nolinememclear:
  436.     move.l    membase,a1
  437.     move.l    memlong,d0
  438.     beq    nomemtclr    ;free memory for text
  439.     jsr    FreeMem(a6)
  440. nomemtclr:
  441.     move.l    4,a6
  442.     tst.l    dosbase
  443.     beq    nodropdos
  444.     move.l    dosbase,a1
  445.     jsr    CloseLibrary(a6)    ;close dos_lib
  446. nodropdos:
  447.     tst.l    graphbase
  448.     beq    nodropgraph
  449.     move.l    graphbase,a1
  450.     jsr    CloseLibrary(a6)    ;close graph_lib
  451. nodropgraph:
  452.     tst.l    intuibase
  453.     beq    nodropintui
  454.     move.l    intuibase,a1
  455.     jsr    CloseLibrary(a6)    ;close intui_lib
  456. nodropintui:
  457.     tst.l    diskmem
  458.     beq    nodropdiskmem
  459.     move.l    #44000,d0
  460.     move.l    diskmem,a1
  461.     jsr    FreeMem(a6)    ;drop diskmem
  462. nodropdiskmem:
  463.     tst.l    infomem
  464.     beq    nodropinfomem
  465.     move.l    #1024,d0
  466.     move.l    infomem,a1
  467.     jsr    FreeMem(a6)    ;drop infomem
  468. nodropinfomem:
  469.     tst.l    startmsg
  470.     beq    quitpltmoreprog
  471.     move.l    startmsg,a1    
  472.     jsr    ReplyMsg(a6)    ;reply wb-start-message
  473. quitpltmoreprog:
  474.     moveq    #0,d0
  475.     moveq    #0,d1
  476.     move.l    startsp,sp
  477.     rts            ;and ... that's the end of PLTMore
  478.  
  479. ; loadfile-routine, gets length of file, allocates mem and finally loads it
  480.  
  481. loadfile:
  482.     move.l    a0,a5        ;keep pointer to filename
  483.     move.l    d0,d5        ;keep mem-type
  484.     move.l    dosbase,a6
  485.     move.l    a5,d1
  486.     moveq    #-2,d2        ;lock-mode = -2 ... read !
  487.     jsr    Lock(a6)    ;get filelock
  488.     move.l    d0,d7        ;keep pointer to filelock
  489.     beq    lerror1        ;no lock ... error !
  490.     move.l    dosbase,a6
  491.     move.l    d7,d1        ;filelock
  492.     move.l    infomem,d2    ;info-memory
  493.     jsr    Examine(a6)    ;examine file-info-data
  494.     tst.l    d0        ;d0 = 0 ? ... Error !
  495.     beq    lerror1
  496.     move.l    d7,d1        ;drop filelock
  497.     jsr    UnLock(a6)
  498.     move.l    infomem,a3
  499.     move.l    124(a3),d0    ;get length of file
  500.     addq.l    #2,d0        ;we want some zero-bytes at the end
  501.     move.l    4,a6
  502.     move.l    d5,d1        ;get requested mem-type
  503.     jsr    AllocMem(a6)    ;allocate memory
  504.     move.l    d0,a2        ;keep memory-pointer
  505.     tst.l    d0        ;no memory ... error !
  506.     beq    lerror1
  507.     move.l    a5,d1        ;filename-pointer
  508.     move.l    #1005,d2    ;open-mode: old
  509.     move.l    dosbase,a6
  510.     jsr    Open(a6)    ;open file
  511.     move.l    d0,d4        ;keep filehandle
  512.     beq    lerror1        ;filehandle = 0 ? ... error !
  513.     move.l    d0,d1
  514.     move.l    a2,d2        ;memory-pointer
  515.     move.l    124(a3),d3    ;length of file
  516.     jsr    Read(a6)    ;read file
  517.     move.l    d4,d1
  518.     jsr    Close(a6)    ;close file
  519.     move.l    124(a3),d4    ;keep length of file
  520.     addq.l    #2,d4        ;we still want some zero-bytes at the end
  521.     move.l    a2,a0        ;data-pointer in a0
  522.     move.l    d4,d0        ;length of data in d0
  523. exitloadfile:
  524.     rts            ;we are ready !
  525. lerror1:
  526.     moveq    #0,d0        ;d0 = 0 ... that means one error
  527.     bra    exitloadfile    ;and we are ready too !
  528.  
  529. ; display the wonderfull PLTMore-help-window
  530.  
  531. plthelp:
  532.     move.l    intuibase,a6
  533.     lea    wabout,a0    ;open help-window
  534.     jsr    OpenWindow(a6)
  535.     move.l    d0,d7        ;keep wdwhandle
  536.     beq    quitplthelp    ;no window ! ... that's unbeliveable
  537.     move.l    graphbase,a6
  538.     move.l    d7,a1
  539.     move.l    50(a1),a1
  540.     moveq    #2,d0        ;set pen to color 2
  541.     jsr    SetAPen(a6)
  542.     move.l    d7,a1
  543.     move.l    50(a1),a1
  544.     moveq    #2,d0        ;rect allmost the whole window
  545.     moveq    #1,d1
  546.     move.w    #537,d2
  547.     move.w    #188,d3
  548.     jsr    RectFill(a6)
  549.     move.l    intuibase,a6
  550.     moveq    #5,d3        ;y-pos of first line
  551.     lea    helptx,a5    ;pointer to help-lines
  552.     moveq    #19,d5        ;20 lines to print
  553. plthelploop1:
  554.     lea    texttext,a4    ;memory for text-line
  555.     moveq    #-1,d6        ;counter for length to pre-zero
  556. plthelploop2:
  557.     addq.w    #1,d6        ;count one more character
  558.     move.b    (a5)+,(a4)+    ;copy it
  559.     bne    plthelploop2    ;not zero ... go on copying
  560.     asl.w    #3,d6        ;8 points per char 
  561.     move.w    #540,d0        ;width of window
  562.     sub.w    d6,d0        ;sub width of text
  563.     lsr.w    #1,d0        ;and divide through 2 to center
  564.     move.l    d7,a0
  565.     move.l    50(a0),a0    ;window-rastport
  566.     lea    textline,a1    ;text-struct
  567.     move.b    #2,1(a1)    ;set background-color to color 2
  568.     move.l    d3,d1        ;get y-pos
  569.     jsr    PrintIText(a6)    ;and print the line
  570.     add.w    #9,d3        ;add 9 to y-pos
  571.     dbra    d5,plthelploop1    ;and go on printing
  572.     lea    textline,a1    ;as the same text-struct is used to display
  573.     clr.b    1(a1)        ;the 'real' text reset back-col to 0
  574.     bclr    #2,pltflag    ;clear flag (see below for the sense of it)
  575. plthelpwait:
  576.     move.l    4,a6
  577.     move.l    d7,a0
  578.     move.l    86(a0),a0    ;window-user-port
  579.     jsr    WaitPort(a6)    ;wait for message ... task is sleeping
  580.     move.l    d7,a0
  581.     move.l    86(a0),a0
  582.     jsr    GetMsg(a6)    ;now ... there's one user-request !
  583.     tst.l    d0
  584.     beq    plthelpwait    ;no ...there's none ... (...strange!)
  585.     move.l    d0,a1
  586.     move.l    20(a1),d6    ;get idcmp of message-cause
  587.     jsr    ReplyMsg(a6)    ;and send message back
  588.     cmp.l    #$8,d6        ;did the user (got bless him/her)
  589.     beq    helpmousepick    ;press one mouse-button ?
  590.     btst    #2,pltflag    ;drop the first key, which possibly opened
  591.     bne    helpmousepick    ;the window (a strange way to avoid that
  592.     bset    #2,pltflag    ;the window is closed at once if it was
  593.     bra    plthelpwait    ;called with the help-key)
  594. helpmousepick:
  595.     move.l    intuibase,a6
  596.     move.l    d7,a0
  597.     jsr    CloseWindow(a6)
  598. quitplthelp:
  599.     rts
  600.  
  601. ; display the wonderfull PLTMore-window
  602.  
  603. dowindow:
  604.     lea    rects,a5    ;table of rects
  605.     moveq    #16,d7        ;number of rects -1
  606. dorecting:
  607.     move.l    graphbase,a6
  608.     move.l    wdwrast,a1
  609.     move.w    (a5)+,d0    ;read color of rect to paint
  610.     jsr    SetAPen(a6)
  611.     move.l    wdwrast,a1
  612.     move.w    (a5)+,d0
  613.     move.w    (a5)+,d1    ;read dimensions of actual rect
  614.     move.w    (a5)+,d2
  615.     move.w    (a5)+,d3
  616.     jsr    RectFill(a6)    ;and finaly do it !
  617.     dbra    d7,dorecting
  618.     bsr    cleardisplay
  619.     move.l    intuibase,a6
  620.     lea    gdgexit,a0
  621.     move.l    wdwhandle,a1
  622.     move.l    #0,a2        ;now we redraw the (text-) gadgets
  623.     jsr    RefreshGadgets(a6)
  624.     moveq    #25,d0
  625.     lea    filename,a0
  626.     lea    tx4,a1
  627. copdofname:
  628.     move.b    (a0)+,(a1)+
  629.     dbra    d0,copdofname
  630.     lea    texte,a5    ;table of texts
  631.     moveq    #4,d7        ;number of texts -1
  632. dotexting:
  633.     move.l    wdwrast,a0
  634.     lea    txtext,a1    ;get text-struct
  635.     move.b    #1,(a1)
  636.     move.b    #0,2(a1)    ;drawmode: jam1
  637.     move.l    (a5)+,d0    ;read x-pos of text
  638.     move.l    (a5)+,d1    ;read y-pos of text
  639.     move.l    (a5)+,txtextpoint    ;adress of textline
  640.     jsr    PrintIText(a6)    ;and print it !
  641.     dbra    d7,dotexting
  642.     rts
  643.  
  644. ; get the line adresses of one wonderfull text
  645.  
  646. scanpage:
  647.     bsr    scanlength    ;at first get the length of one page
  648.     move.l    linemem,a4    ;memory for line-adresses
  649.     move.l    membase,a5    ;data-memory
  650.     btst    #7,pltflag    ;first scan: only counting the lines
  651.     beq    firstscan1
  652.     move.l    a5,(a4)+    ;first line is at zero-pos
  653. firstscan1:
  654.     moveq    #0,d5        ;clear line-counter
  655.     clr.w    maxline        ;clear number of last line
  656. scanpageloop:
  657.     cmp.b    #10,(a5)
  658.     beq    gotlinefeed    ;is there one linefeed ?
  659.     cmp.b    #13,(a5)
  660.     beq    gotcarriage    ;is there one carriage ?
  661.     tst.b    (a5)+
  662.     bne    scanpageloop    ;we are not at the end of the text now !
  663. ermitend:
  664.     btst    #7,pltflag    ;first scan: counting the lines
  665.     beq    firstscan2
  666.     move.w    pagelength,d0    ;get the number of the first line 
  667.     sub.w    d0,maxline    ;of the last display-page
  668.     bpl    longtext1
  669.     clr.w    maxline
  670. longtext1:
  671.     bsr    pltworkoff
  672.     bra    newshowpage    ;ready scanning the page, now show it!
  673. firstscan2:
  674.     bset    #7,pltflag    ;set flag for second scan
  675.     move.l    4,a6
  676.     moveq    #1,d0
  677.     add.w    maxline,d0
  678.     move.w    d0,lines    ;get memory for adresses of lines
  679.     asl.l    #2,d0
  680.     move.l    #$10001,d1
  681.     jsr    AllocMem(a6)
  682.     move.l    d0,linemem    ;no memory ??? ... damned !
  683.     beq    quitpltmore
  684.     bra    scanpage    ;now second scan ... getting adresses
  685. gotlinefeed:
  686. gotcarriage:
  687.     adda.l    #1,a5        ;add one to get adress of the next line
  688.     btst    #7,pltflag    ;first scan: only counting
  689.     beq    firstscan3
  690.     move.l    a5,(a4)+    ;keep the adress
  691. firstscan3:
  692.     addq.w    #1,maxline    ;count the lines
  693.     bra    scanpageloop    ;goon scanning the page
  694.  
  695. ; get length of display-page
  696.  
  697. scanlength:
  698.     move.l    wdwhandle,a0
  699.     moveq    #0,d0
  700.     move.w    10(a0),d0    ;get window height
  701.     sub.w    #40,d0        ;sub 40 lines for gadgets and border
  702.     divu    #9,d0        ;divide through 9 to get length
  703.     move.w    d0,pagelength    ;of page
  704.     rts
  705.  
  706. ; get the tab-positions in a line
  707.  
  708. scantabs:
  709.     lea    tabmem,a0    ;pointer to memory of tabs
  710.     move.l    a0,a1
  711.     moveq    #19,d0
  712. cleartabs:
  713.     clr.l    (a1)+        ;clear memory for tab-positions
  714.     dbra    d0,cleartabs
  715.     move.b    spacecount,d0    ;read the spaces per tab value
  716.     moveq    #79,d2        ;get the last possible tab-position
  717.     sub.b    d0,d2        ;within a line of a length of 79 chars
  718.     move.b    d0,d1
  719. scannintab:
  720.     move.b    d1,(a0)+    ;write actual tab-position in memory
  721.     add.b    d0,d1        ;add the spaces per tab value
  722.     cmp.b    d2,d1        ;and go on until the last tab-position
  723.     bls    scannintab    ;is passed
  724.     clr.b    (a0)        ;zero-byte at the end of tab-pos-table
  725. scantabout:
  726.     move.l    intuibase,a6
  727.     move.l    wdwrast,a0    ;print the spaces per tab value
  728.     lea    txtext,a1
  729.     lea    tx3,a2        ;on the screen
  730.     move.b    spacecount,8(a2)
  731.     add.b    #48,8(a2)
  732.     move.b    #1,2(a1)    ;drawmode: jam2
  733.     move.b    #2,1(a1)    ;back-color
  734.     move.w    #498,d0
  735.     moveq    #22,d1
  736.     move.l    a2,txtextpoint
  737.     jsr    PrintIText(a6)
  738.     rts
  739.  
  740. ; look for the previous or next appearance of the selected 'search-text'
  741.  
  742. searchprev:
  743.     bset    #1,pltflag    ;set flag for searching the previous
  744.     bra    searcher
  745. searchnext:
  746.     bclr    #1,pltflag    ;set flag for searching the next
  747. searcher:
  748.     bsr    pltworkon
  749.     move.w    linecount,memo2    ;remember actual line
  750. searchon:
  751.     move.l    linemem,a4
  752.     moveq    #0,d6        ;get memory-pointer to first
  753.     move.w    linecount,d6
  754.     asl.l    #2,d6        ;character of the actual line
  755.     adda.l    d6,a4
  756.     move.l    (a4),a5
  757.     bsr    searchline    ;and search this line
  758.     tst.b    d7
  759.     bne    foundthisline    ;text was found in this line or not ?
  760.     btst    #1,pltflag
  761.     bne    searchingprev    ;if the text wasn't found and we are
  762.     move.w    maxline,d0    
  763.     add.w    pagelength,d0    ;searching next then look if there is
  764.     cmp.w    linecount,d0
  765.     beq    nosearchnextline    ;a next line to scan
  766.     addq.w    #1,linecount
  767.     bra    searchon    ;and then go on searching
  768. searchingprev:
  769.     tst.w    linecount    ;if we are searching previous then
  770.     beq    nosearchnextline
  771.     subq.w    #1,linecount    ;look if there is a previous line
  772.     bra    searchon
  773. foundthisline:
  774.     move.l    a5,searchfound    ;keep the adress of text we found and
  775.     move.w    linecount,foundline    ;number of the line
  776.     bsr    showpage    ;and show the page
  777.     move.l    graphbase,a6
  778.     move.l    wdwrast,a1
  779.     moveq    #3,d0        ;set color to 3 to underline
  780.     jsr    SetAPen(a6)
  781.     move.l    wdwrast,a1
  782.     move.w    searchlinea,d0    ;set pen to beginning of the
  783.     moveq    #40,d1
  784.     jsr    MovePen(a6)    ;first char of text
  785.     move.l    wdwrast,a1
  786.     move.w    searchlineb,d0
  787.     moveq    #40,d1        ;and the underline it
  788.     jsr    Draw(a6)
  789.     bra    readysearching    ;ready !
  790. nosearchnextline:
  791.     move.w    memo2,linecount    ;if text wasn't found
  792.     bsr    showpage    ;redisplay original page
  793. readysearching:
  794.     bsr    pltworkoff
  795.     bra    waitmessage
  796.  
  797. ; look if requested text appears in this line
  798.  
  799. searchline:
  800.     moveq    #0,d7
  801.     lea    searchtext,a4    ;pointer text
  802.     moveq    #0,d4
  803. getsearchlength:
  804.     addq.b    #1,d4        ;get length of requested text plus 1
  805.     tst.b    (a4)+
  806.     bne    getsearchlength
  807.     cmp.b    #1,d4        ;length = 1 => no text
  808.     beq    emptysearch    
  809.     moveq    #0,d2        ;counter for actual position in line
  810. searchline1:
  811.     addq.b    #1,d2
  812.     move.l    a5,a3        ;get actual start-position for searching
  813.     cmp.b    #9,(a3)        ;look for 'tab' -char
  814.     bne    notabinsearch
  815.     lea    tabmem,a0    ;get table of tab-positions
  816. searchgettabs:
  817.     move.b    (a0)+,d0    ;no more tabs ... we are ready
  818.     beq    notabinsearch
  819.     cmp.b    d0,d2        ;found tab at the actual pos ?
  820.     beq    notabinsearch
  821.     bge    searchgettabs    ;pos is behind tab ? ... go on looking
  822. foundsearchtab:
  823.     cmp.b    d0,d2        ;if actual pos = tab-pos
  824.     beq    notabinsearch    ;we ar ready
  825.     addq.b    #1,d2        ;if not add one pos to counter until
  826.     bra    foundsearchtab    ;actual pos = tab-pos
  827. notabinsearch:
  828.     lea    searchtext,a4    ;pointer to requested text
  829.     move.l    d4,d3
  830.     subq.l    #2,d3        ;length minus 2
  831. searchline2:
  832.     move.b    (a3)+,d0    ;get actual char in text
  833.     beq    searchlineend
  834.     cmp.b    #10,d0        ;zero, linefeed and carriage return
  835.     beq    searchlineend
  836.     cmp.b    #13,d0        ;reports end of line
  837.     beq    searchlineend
  838.     bclr    #5,d0        ;search-routine is not to be case sensitive
  839.     move.b    (a4)+,d1    ;get next char of requested text
  840.     bclr    #5,d1        ;not case sensitive
  841.     cmp.b    d0,d1
  842.     bne    notsearchfound    ;are the two characters equal ?
  843.     dbra    d3,searchline2    ;go on searching
  844.     move.w    memo2,d0
  845.     cmp.w    linecount,d0    ;if actual line is first line which was
  846.     bne    nochecksame    ;was searched, no check is made
  847.     cmpa.l    searchfound,a5    ;if the position of found text is equal to
  848.     beq    notsearchfound    ;the last one nothing of interest was found
  849.     move.w    foundline,d0
  850.     cmp.w    linecount,d0
  851.     beq    notsearchfound
  852. nochecksame:
  853.     asl.w    #3,d2
  854.     subq.w    #6,d2
  855.     move.w    d2,searchlinea    ;get start and end position of line
  856.     move.w    d2,searchlineb
  857.     subq.w    #1,d4        ;to mark the text
  858.     asl.w    #3,d4
  859.     add.w    d4,searchlineb
  860.     moveq    #1,d7
  861.     rts
  862. notsearchfound:
  863.     adda.l    #1,a5        ;add one to text-pointer to compare
  864.     bra    searchline1    ;and go on searching
  865. searchlineend:
  866. emptysearch:
  867.     rts
  868.  
  869. ; increase spaces per tab value
  870.  
  871. upspacetab:
  872.     cmp.b    #9,spacecount    ;maximum is 9 spaces per tab
  873.     beq    waitmessage
  874.     addq.b    #1,spacecount
  875.     bra    newshowpage
  876.  
  877. ; print text to prt:
  878.  
  879. printtext:
  880.     move.l    dosbase,a6
  881.     move.l    #prtname,d1
  882.     move.l    #1006,d2    ;Mode: NEW
  883.     jsr    Open(a6)    ;open prt: for output
  884.     move.l    d0,prthandle
  885.     beq    waitmessage
  886.     bsr    pltworkon    ;turn on sleeping-pointer
  887.     move.w    linecount,prtcount
  888. printtextloop:
  889.     move.l    linemem,a4
  890.     moveq    #0,d5
  891.     move.w    prtcount,d5    ;get adress of first char of 
  892.     asl.l    #2,d5
  893.     add.l    d5,a4
  894.     move.l    (a4),a5        ;line to be shown
  895.     bsr    getline
  896.     lea    texttext,a0
  897.     move.b    #13,79(a0)    ;linefeed and
  898.     move.b    #10,80(a0)    ;carriage-return at the end of the line
  899.     move.l    dosbase,a6
  900.     move.l    prthandle,d1
  901.     move.l    a0,d2
  902.     moveq    #81,d3        ;print line to prt:
  903.     jsr    Write(a6)
  904.     move.l    4,a6
  905.     move.l    wdwhandle,a0
  906.     move.l    86(a0),a0    ;window user-port
  907.     jsr    GetMsg(a6)    ;get intuimessage
  908.     tst.l    d0
  909.     beq    noprintstop    ;and look if a gadget or a key was
  910.     move.l    d0,a1        ;pressed to abort printing
  911.     move.l    20(a1),d7
  912.     jsr    ReplyMsg(a6)    ;and reply message
  913.     cmp.l    #$40,d7
  914.     beq    printoutend
  915.     cmp.l    #$400,d7
  916.     beq    printoutend
  917. noprintstop:
  918.     addq.w    #1,prtcount
  919.     move.w    maxline,d0
  920.     add.w    pagelength,d0    ;go on printing untill the end
  921.     cmp.w    prtcount,d0
  922.     bls    printoutend    ;of the text
  923.     bra    printtextloop
  924. printoutend:
  925.     bsr    pltworkoff
  926.     lea    texttext,a0
  927.     clr.b    79(a0)
  928.     move.l    dosbase,a6
  929.     move.l    prthandle,d1    ;close prt:
  930.     jsr    Close(a6)
  931.     bra    waitmessage    
  932.  
  933. ;decrease spaces per tab value
  934.  
  935. dnspacetab:
  936.     cmp.b    #1,spacecount    ;minimum ist 1 space per tab
  937.     beq    waitmessage
  938.     subq.b    #1,spacecount
  939.     bra    newshowpage
  940.  
  941. ;show first page of text
  942.  
  943. firstpage:
  944.     clr.w    linecount
  945.     bsr    showpage
  946.     bra    waitmessage
  947.  
  948. ;show last page of text
  949.  
  950. lastpage:
  951.     move.w    maxline,linecount
  952.     bsr    showpage
  953.     bra    waitmessage
  954.  
  955. ;show previous page of text
  956.  
  957. showprevpage:
  958.     tst.w    linecount
  959.     beq    waitmessage
  960.     move.w    pagelength,d0    ;look if there is another previous
  961.     subq.w    #1,d0
  962.     cmp.w    linecount,d0    ;page to show
  963.     bls    okshowprevpage
  964.     move.w    d0,linecount    ;if not ... show the first page
  965. okshowprevpage:
  966.     sub.w    d0,linecount
  967.     bsr    showpage
  968.     bra    waitmessage
  969.  
  970. ;show next page of text
  971.  
  972. shownextpage:
  973.     move.w    maxline,d0    ;look if there is another
  974.     cmp.w    linecount,d0
  975.     beq    waitmessage
  976.     move.w    pagelength,d1
  977.     subq.w    #1,d1        ;page to show
  978.     add.w    d1,linecount
  979.     cmp.w    linecount,d0    ;if not ... show the last page
  980.     bge    okshownextpage
  981.     move.w    maxline,linecount
  982. okshownextpage:
  983.     bsr    showpage
  984.     bra    waitmessage
  985.  
  986. ;show previous line of text
  987.  
  988. showprevline:
  989.     tst.w    linecount    ;we are still at the beginning of
  990.     beq    waitmessage    ;of the text ?
  991.     subq.w    #1,linecount    ;if not, decrease the line number
  992.     move.l    wdwrast,a1
  993.     move.l    wdwhandle,a0
  994.     moveq    #0,d0
  995.     moveq    #-9,d1        ;scroll down text-display one line
  996.     moveq    #4,d2
  997.     moveq    #32,d3
  998.     move.w    8(a0),d4
  999.     subq.w    #4,d4
  1000.     move.w    10(a0),d5
  1001.     sub.w    #9,d5
  1002.     move.l    graphbase,a6
  1003.     jsr    ScrollRaster(a6)
  1004.     bsr    getlineadress
  1005.     moveq    #32,d3
  1006.     bsr    showline    ;and print it
  1007.     bra    waitmessage
  1008.  
  1009. getlineadress:
  1010.     move.l    linemem,a4
  1011.     moveq    #0,d5
  1012.     move.w    linecount,d5    ;get adress of first char of
  1013.     asl.l    #2,d5
  1014.     adda.l    d5,a4
  1015.     move.l    (a4),a5        ;line to be shown
  1016.     rts
  1017.  
  1018. ; show next line of text
  1019.  
  1020. shownextline:
  1021.     move.w    maxline,d0    ;look if there is another line
  1022.     cmp.w    linecount,d0
  1023.     bls    waitmessage    ;to show ?
  1024.     addq.w    #1,linecount
  1025.     move.l    wdwrast,a1
  1026.     move.l    wdwhandle,a0
  1027.     moveq    #0,d0
  1028.     moveq    #9,d1        ;scroll up text-display one line
  1029.     moveq    #4,d2
  1030.     moveq    #32,d3
  1031.     move.w    8(a0),d4
  1032.     subq.w    #4,d4
  1033.     move.w    10(a0),d5
  1034.     sub.w    #9,d5
  1035.     move.l    graphbase,a6
  1036.     jsr    ScrollRaster(a6)
  1037.     move.l    linemem,a4
  1038.     moveq    #0,d5
  1039.     move.w    linecount,d5
  1040.     add.w    pagelength,d5
  1041.     subq.w    #1,d5        ;get adress of first char of 
  1042.     asl.l    #2,d5
  1043.     adda.l    d5,a4
  1044.     move.l    (a4),a5        ;line to be shown
  1045.     moveq    #32,d3
  1046.     moveq    #0,d2
  1047.     move.w    pagelength,d2
  1048.     subq.w    #1,d2
  1049.     mulu    #9,d2
  1050.     add.w    d2,d3        ;and print it
  1051.     bsr    showline
  1052.     bra    waitmessage
  1053.  
  1054. ;show one page of text, beginning with the actual line
  1055.  
  1056. showpage:
  1057.     bsr    cleardisplay
  1058.     bsr    getlineadress
  1059.     move.w    pagelength,d5    ;get number of lines to show
  1060.     subq.w    #1,d5
  1061.     moveq    #32,d3        ;first y-pos is 32
  1062.     moveq    #0,d6        ;count the lines (necessary for displaying
  1063. showpageloop:            ;lines of the last page on the first
  1064.     bsr    showline    ;display-line if 'search' found s.th.
  1065.     adda.l    #1,a5        ;within these lines
  1066.     add.w    #9,d3
  1067.     addq.w    #1,d6
  1068.     move.w    linecount,d0
  1069.     add.w    d6,d0        ;if displaying passed the last line
  1070.     move.w    maxline,d1    ;(reason for this see above)
  1071.     add.w    pagelength,d1
  1072.     cmp.w    d1,d0
  1073.     bge    endtext        ;abord displaying the lines
  1074.     cmp.w    lines,d0
  1075.     bge    endtext
  1076.     dbra    d5,showpageloop
  1077. endtext:
  1078.     rts
  1079.  
  1080. ; convert one line of text into puffer
  1081.  
  1082. getline:
  1083.     lea    texttext,a4    ;memory in intuitext-struct
  1084.     moveq    #78,d4        ;display a maximum of 79 characters
  1085.     moveq    #0,d7        ;count the characters
  1086. showlloop:
  1087.     move.b    (a5),d0        ;read next character
  1088.     cmp.b    #9,d0
  1089.     beq    foundtabu    ;is this one tab ???
  1090.     cmp.b    #10,d0
  1091.     beq    linefeed
  1092.     cmp.b    #13,d0        ;or even the end of the line ???
  1093.     beq    carriage
  1094.     tst.b    d0
  1095.     beq    linefeed
  1096.     move.b    (a5)+,(a4)+    ;copy character and
  1097.     addq.b    #1,d7
  1098.     dbra    d4,showlloop    ;go on scanning the text
  1099.     bra    lineready
  1100. foundtabu:
  1101.     adda.l    #1,a5
  1102. dotabin:            ;if a tab is found add spaces
  1103.     move.b    #32,(a4)+    
  1104.     addq.b    #1,d7
  1105.     dbra    d4,tabon
  1106.     bra    lineready    ;until the next tab-pos
  1107. tabon:
  1108.     lea    tabmem,a0
  1109. gettabsloop:            ;is reached
  1110.     move.b    (a0)+,d0
  1111.     beq    dotabin
  1112.     cmp.b    d0,d7
  1113.     beq    showlloop
  1114.     bra    gettabsloop
  1115. linefeed:
  1116. carriage:
  1117.     move.b    #32,(a4)+    ;fill up the rest of the line
  1118.     dbra    d4,carriage    ;with spaces
  1119. lineready:
  1120.     rts
  1121.  
  1122. ;show one line of text, terminated by linefeed of carriage return
  1123.  
  1124. showline:
  1125.     bsr    getline
  1126.     move.l    wdwhandle,a0
  1127.     lea    texttext,a1
  1128.     move.w    8(a0),d0
  1129.     lsr.w    #3,d0
  1130.     clr.b    -1(a1,d0)
  1131.     move.l    intuibase,a6
  1132.     move.l    wdwrast,a0
  1133.     lea    textline,a1    ;and then print the line
  1134.     move.l    d3,d1
  1135.     moveq    #5,d0
  1136.     jsr    PrintIText(a6)
  1137.  
  1138.  
  1139. ; show actual position and last page-beginning-position
  1140. posanzeige:
  1141.     lea    postxt,a0
  1142.     moveq    #0,d0
  1143.     moveq    #16,d1
  1144.     move.w    linecount,d0    ;convert actual line
  1145.     divu    #10000,d0
  1146.     addi.b    #48,d0
  1147.     move.b    d0,4(a0)
  1148.     lsr.l    d1,d0        ;into ASCII-text
  1149.     divu    #1000,d0
  1150.     addi.b    #48,d0
  1151.     move.b    d0,5(a0)
  1152.     lsr.l    d1,d0
  1153.     divu    #100,d0
  1154.     addi.b    #48,d0
  1155.     move.b    d0,6(a0)
  1156.     lsr.l    d1,d0
  1157.     divu    #10,d0
  1158.     addi.b    #48,d0
  1159.     move.b    d0,7(a0)
  1160.     lsr.l    d1,d0
  1161.     addi.b    #48,d0
  1162.     move.b    d0,8(a0)
  1163.     moveq    #0,d0
  1164.     move.w    maxline,d0
  1165.     divu    #10000,d0    ;convert beginning-line of the
  1166.     addi.b    #48,d0
  1167.     move.b    d0,10(a0)
  1168.     lsr.l    d1,d0
  1169.     divu    #1000,d0
  1170.     addi.b    #48,d0
  1171.     move.b    d0,11(a0)
  1172.     lsr.l    d1,d0
  1173.     divu    #100,d0
  1174.     addi.b    #48,d0        ;last page into ASCII-text
  1175.     move.b    d0,12(a0)
  1176.     lsr.l    d1,d0
  1177.     divu    #10,d0
  1178.     addi.b    #48,d0
  1179.     move.b    d0,13(a0)
  1180.     lsr.l    d1,d0
  1181.     addi.b    #48,d0
  1182.     move.b    d0,14(a0)
  1183.     move.l    wdwrast,a0
  1184.     move.l    intuibase,a6
  1185.     lea    postext,a1    ;and print them
  1186.     moveq    #0,d1
  1187.     moveq    #0,d0
  1188.     jsr    PrintIText(a6)
  1189.     rts
  1190.  
  1191. ; variables, texts, names, flags, handles, pointers and so on ...
  1192.  
  1193. searchtext:    ds.b    42    ;memory for text to be searches
  1194.         even
  1195. tabmem:        ds.b    82    ;memory for tabulator positions
  1196.         even
  1197. dosname:    dc.b    "dos.library",0
  1198.         even
  1199. intuiname:    dc.b    "intuition.library",0
  1200.         even
  1201. graphname:    dc.b    "graphics.library",0
  1202.         even
  1203. prtname:    dc.b    "prt:",0
  1204.         even
  1205. dosbase:    dc.l    0
  1206. intuibase:    dc.l    0
  1207. graphbase:    dc.l    0
  1208. diskmem:    dc.l    0
  1209. infomem:    dc.l    0
  1210. wdwhandle:    dc.l    0    ;windowhandle
  1211. wdwrast:    dc.l    0    ;windowrastport
  1212. linemem:    dc.l    0    ;pointer to memory to keep line adresses
  1213. lines:        dc.w    0    ;number of lines
  1214. thistask:    dc.l    0    ;pointer to task struct
  1215. startsp:    dc.l    0    ;stackpointer when programm is started
  1216. startmsg:    dc.l    0    ;wb-startup-message-handle
  1217. membase:    dc.l    0    ;pointer to memory keeping the text
  1218. memlong:    dc.l    0    ;length of the text
  1219. searchfound:    dc.l    0    ;pointer to last succesfull search
  1220. memo1:        dc.l    0    ;one longword to keep s.th. in
  1221. memo2:        dc.w    0    ;one word to keep s.th. in
  1222. foundline:    dc.w    0    ;number of line with succesfull search
  1223. linecount:    dc.w    0    ;actual line-number
  1224. maxline:    dc.w    0    ;maximum line-number
  1225. pagelength:    dc.w    0    ;length of display-page
  1226. searchlinea:    dc.w    0    ;beginning pos of line to underline
  1227. searchlineb:    dc.w    0    ;ending pos of line to underline
  1228. prthandle:    dc.l    0
  1229. prtcount:    dc.w    0
  1230. spacecount:    dc.b    8    ;spaces per tab value
  1231. pltflag:    dc.b    0    ;one byte to keep s.th. in
  1232.         even
  1233.  
  1234. ;table of dimensions of the rectangles that make the window-look
  1235.  
  1236. rects:    dc.w    1,0,10,639,30
  1237.     dc.w    2,2,11,47,19
  1238.     dc.w    2,50,11,93,19
  1239.     dc.w    2,96,11,179,19
  1240.     dc.w    0,182,11,394,19
  1241.     dc.w    2,497,11,637,19
  1242.     dc.w    2,2,21,36,29
  1243.     dc.w    2,39,21,66,29
  1244.     dc.w    2,69,21,91,29
  1245.     dc.w    2,94,21,115,29
  1246.     dc.w    2,118,21,147,29
  1247.     dc.w    2,150,21,179,29
  1248.     dc.w    2,497,21,637,29
  1249.     dc.w    2,182,21,266,29
  1250.     dc.w    2,269,21,351,29
  1251.     dc.w    0,354,21,494,29
  1252.     dc.w    2,397,11,493,19
  1253.  
  1254. ;table of texts and their positions that make the window-look
  1255.  
  1256. texte:    dc.l    8,12,tx1,12,22,tx2,498,22,tx3,186,12,tx4,409,12,tx0
  1257.  
  1258. tx0:    dc.b    "PRINT TEXT",0
  1259.     even
  1260. tx1:    dc.b    "EXIT  HELP  LOAD FILE",0
  1261.     even
  1262. tx2:    dc.b    "[<  <<  <  >  >>  >]  SEEK PREV  SEEK NEXT",0
  1263.     even
  1264. tx3:    dc.b    "SPC/TAB:8|UP|DN",0
  1265.     even
  1266. tx4:    ds.b    28
  1267.  
  1268.  
  1269. ;help-message
  1270.  
  1271. helptx:
  1272.  dc.b    "-----===== Platinum-More-Replacement - PLTMore+ =====-----",0
  1273.  dc.b    "© 1991 by Joerg Schliesser / Platinum Softwareline",0
  1274.  dc.b    "Rotenwaldstrasse 20 / D-7000 Stuttgart 1 / Germany",0
  1275.  dc.b    "PLTMore is freely distributable (also on commercially",0
  1276.  dc.b    "distributed disks) as long as this text remains unchanged",0
  1277.  dc.b    " ",0
  1278.  dc.b    "PLTMore keyboard command summary:",0
  1279.  dc.b    "Show first page .................................... 7/Home",0
  1280.  dc.b    "Show last page ...................................... 1/End",0
  1281.  dc.b    "Show next page ................. Shift & CRSR Dn or 3/Pg Dn",0
  1282.  dc.b    "Show previous page ............. Shift & CRSR Up or 9/Pg Up",0
  1283.  dc.b    "Show next line ............................ CRSR Dn or 2/Dn",0
  1284.  dc.b    "Show previous line ........................ CRSR Up or 8/Up",0
  1285.  dc.b    "Seek next ....................................... Shift & N",0
  1286.  dc.b    "Seek previous ................................... Shift & P",0
  1287.  dc.b    "Load textfile ................................... Shift & L",0
  1288.  dc.b    "Add one more space per tab ...................... Shift & +",0
  1289.  dc.b    "Sub one space per tab ........................... Shift & -",0
  1290.  dc.b    "Quit PLTMore .......................................... Esc",0
  1291.  dc.b    "To close this window press any key or mouse button",0
  1292.     even
  1293.  
  1294. ;window-structs
  1295.  
  1296. wplt:
  1297.     dc.w    0,0,640,200    ;x,y,w,h
  1298.     dc.b    2,1        ;colors
  1299.     dc.l    $446        ;idcmp,rawkey,upgadget,newsize,refresh
  1300.     dc.l    $2011007    ;activ,rmbtrap,front/back,sizing,drag
  1301.     dc.l    gdgexit,0,wplttitle,0,0
  1302.     dc.w    80,60,640,512
  1303.     dc.w    1
  1304. wplttitle:
  1305.  dc.b "PLTMore+ V2.0 © 1991 by Joerg Schliesser / Platinum Softwareline",0
  1306.     even
  1307.  
  1308. wabout:
  1309.     dc.w    49,5,540,190    ;x,y,w,h
  1310.     dc.b    2,1        ;colors
  1311.     dc.l    $408        ;idcmp,rawkey,mousebuttons
  1312.     dc.l    $2011000    ;activ,rmbtrap,borderless
  1313.     dc.l    0,0,0,0,0,0,0
  1314.     dc.w    1
  1315.  
  1316. ; gadget structs
  1317.  
  1318. gdgexit:
  1319.     dc.l    gdgloadfile
  1320.     dc.w    2,11,46,9,0,1,1
  1321.     dc.l    0,0,0,0,0
  1322.     dc.w    1
  1323.     dc.l    0
  1324. gdgloadfile:
  1325.     dc.l    gdgboftext
  1326.     dc.w    96,11,84,9,0,1,1
  1327.     dc.l    0,0,0,0,0
  1328.     dc.w    2
  1329.     dc.l    0
  1330. gdgboftext:
  1331.     dc.l    gdgprevpage
  1332.     dc.w    2,21,35,9,0,1,1
  1333.     dc.l    0,0,0,0,0
  1334.     dc.w    3
  1335.     dc.l    0
  1336. gdgprevpage:
  1337.     dc.l    gdgprevline
  1338.     dc.w    39,21,28,9,0,1,1
  1339.     dc.l    0,0,0,0,0
  1340.     dc.w    4
  1341.     dc.l    0
  1342. gdgprevline:
  1343.     dc.l    gdgnextline
  1344.     dc.w    69,21,23,9,0,1,1
  1345.     dc.l    0,0,0,0,0
  1346.     dc.w    5
  1347.     dc.l    0
  1348. gdgnextline:
  1349.     dc.l    gdgnextpage
  1350.     dc.w    94,21,22,9,0,1,1
  1351.     dc.l    0,0,0,0,0
  1352.     dc.w    6
  1353.     dc.l    0
  1354. gdgnextpage:
  1355.     dc.l    gdgeoftext
  1356.     dc.w    118,21,30,9,0,1,1
  1357.     dc.l    0,0,0,0,0
  1358.     dc.w    7
  1359.     dc.l    0
  1360. gdgeoftext:
  1361.     dc.l    gdgsearchtext
  1362.     dc.w    150,21,30,9,0,1,1
  1363.     dc.l    0,0,0,0,0
  1364.     dc.w    8
  1365.     dc.l    0
  1366. gdgsearchtext:
  1367.     dc.l    gdgspcup
  1368.     dc.w    356,22,136,8,0,2,4
  1369.     dc.l    0,0,0,0,searchtextgdginfo
  1370.     dc.w    9
  1371.     dc.l    0
  1372. searchtextgdginfo:
  1373.     dc.l    searchtext,0
  1374.     dc.w    0,40,0,0,0,0,0,0
  1375.     dc.l    0,0,0
  1376. gdgspcup:
  1377.     dc.l    gdgspcdn
  1378.     dc.w    575,21,23,9,0,1,1
  1379.     dc.l    0,0,0,0,0
  1380.     dc.w    10
  1381.     dc.l    0
  1382. gdgspcdn:
  1383.     dc.l    gdgsearchprev
  1384.     dc.w    599,21,23,9,0,1,1
  1385.     dc.l    0,0,0,0,0
  1386.     dc.w    11
  1387.     dc.l    0
  1388. gdgsearchprev:
  1389.     dc.l    gdgsearchnext
  1390.     dc.w    182,21,85,9,0,1,1
  1391.     dc.l    0,0,0,0,0
  1392.     dc.w    12
  1393.     dc.l    0
  1394. gdgsearchnext:
  1395.     dc.l    gdghelp
  1396.     dc.w    269,21,83,9,0,1,1
  1397.     dc.l    0,0,0,0,0
  1398.     dc.w    13
  1399.     dc.l    0
  1400. gdghelp:
  1401.     dc.l    gdgprint
  1402.     dc.w    50,11,44,9,0,1,1
  1403.     dc.l    0,0,0,0,0
  1404.     dc.w    14
  1405.     dc.l    0
  1406. gdgprint:
  1407.     dc.l    0
  1408.     dc.w    397,11,97,9,0,1,1
  1409.     dc.l    0,0,0,0,0
  1410.     dc.w    15
  1411.     dc.l    0
  1412.  
  1413. ; text-structs
  1414.  
  1415. postext:
  1416.     dc.b    1,2,1
  1417.     even
  1418.     dc.w    499,12
  1419.     dc.l    0,postxt,0
  1420. postxt:    dc.b    "POS:00000/00000",0
  1421.     even
  1422.  
  1423. textline:
  1424.     dc.b    1,0,1
  1425.     even
  1426.     dc.l    0,0,texttext,0
  1427. texttext:    ds.b    82
  1428.  
  1429. ; display rendered fields (field-table => a5, number of fields => d7)
  1430.  
  1431. dofields:
  1432.     move.l    graphbase,a6
  1433. fielding:
  1434.     move.w    (a5)+,d4    ;x-pos
  1435.     move.w    (a5)+,d5    ;y-pos
  1436.     move.w    (a5)+,d6    ;width of field
  1437.     move.w    (a5)+,fieldheight    ;height of field
  1438.     move.l    dorast,a1    ;get rastport
  1439.     moveq    #1,d0
  1440.     jsr    SetAPen(a6)    ;set color for outline
  1441.     move.l    dorast,a1
  1442.     move.w    d4,d0
  1443.     move.w    d5,d1
  1444.     move.w    d4,d2
  1445.     move.w    d5,d3
  1446.     add.w    d6,d2
  1447.     add.w    fieldheight,d3
  1448.     jsr    RectFill(a6)    ;draw outline of field
  1449.     move.l    dorast,a1
  1450.     move.w    (a5)+,d0
  1451.     jsr    SetAPen(a6)    ;set color for field
  1452.     move.l    dorast,a1
  1453.     move.w    d4,d0
  1454.     move.w    d5,d1
  1455.     move.w    d4,d2
  1456.     move.w    d5,d3
  1457.     add.w    #2,d0
  1458.     add.w    #1,d1
  1459.     add.w    d6,d2
  1460.     add.w    fieldheight,d3
  1461.     sub.w    #2,d2
  1462.     sub.w    #1,d3        ;draw field
  1463.     jsr    RectFill(a6)
  1464.     dbra    d7,fielding    ;go on...
  1465.     rts            
  1466.  
  1467. ; print some texts (table of texts => a5, number of texts => d7)
  1468.  
  1469. dotexts:
  1470.     move.l    intuibase,a6
  1471. texting:
  1472.     move.l    dorast,a0    ;get rastport
  1473.     lea    txtext,a1
  1474.     move.w    (a5)+,d0    ;get x-pos
  1475.     move.w    (a5)+,d1    ;get y-pos
  1476.     move.l    (a5)+,txtextpoint    ;pointer to ascii-text
  1477.     jsr    PrintIText(a6)    ;print it ...
  1478.     dbra    d7,texting
  1479.     rts
  1480.  
  1481. ; request one file-selection
  1482.  
  1483. filerequest:
  1484.     clr.b    infoflag    ;don't disply '.info'-files
  1485.     clr.w    iactiv        ;and unselect the gadgets
  1486.     move.l    intuibase,a6
  1487.     lea    filewdw,a0
  1488.     jsr    OpenWindow(a6)    ;try to open requester-window
  1489.     move.l    d0,filewdwhandle
  1490.     beq    filewindopenerror
  1491.     move.l    d0,a0
  1492.     move.l    50(a0),filerast    ;keep the rastport
  1493.     lea    filefields,a5
  1494.     moveq    #19,d7
  1495.     move.l    filerast,dorast
  1496.     bsr    dofields    ;display fields for file-requester
  1497.     lea    filetexte,a5
  1498.     moveq    #16,d7
  1499.     bsr    dotexts        ;display texts for file-requester
  1500.     lea    parentgdg,a0
  1501.     move.l    filewdwhandle,a1
  1502.     move.l    #0,a2        ;remake the gadgets (... strings)
  1503.     jsr    RefreshGadgets(a6)
  1504.     bsr    showdir        ;display the old directory
  1505. filewait:
  1506.     move.l    4,a6
  1507.     move.l    filewdwhandle,a0
  1508.     move.l    86(a0),a0
  1509.     jsr    WaitPort(a6)    ;wait for user-action
  1510.     move.l    filewdwhandle,a0
  1511.     move.l    86(a0),a0
  1512.     jsr    GetMsg(a6)    ;get the message ...
  1513.     tst.l    d0
  1514.     beq    filewait    ;if there was one ...
  1515.     move.l    d0,a1
  1516.     cmp.l    #$8,20(a1)    ;mouse-button-message only is necessary
  1517.     bne    norequebutton    ;if scroll-gadget is still selected
  1518.     jsr    ReplyMsg(a6)    ;... drop it
  1519.     bra    filewait
  1520. norequebutton:
  1521.     move.l    28(a1),a5    ;get adress of selected gadget
  1522.     jsr    ReplyMsg(a6)    ;reply the message
  1523.     moveq    #0,d4
  1524.     cmpa.l    #e1gdg,a5
  1525.     beq    selentry    ;look if one of the 10
  1526.     moveq    #1,d4
  1527.     cmpa.l    #e2gdg,a5
  1528.     beq    selentry    ;directory-entries
  1529.     moveq    #2,d4
  1530.     cmpa.l    #e3gdg,a5
  1531.     beq    selentry    ;was selected
  1532.     moveq    #3,d4
  1533.     cmpa.l    #e4gdg,a5
  1534.     beq    selentry
  1535.     moveq    #4,d4
  1536.     cmpa.l    #e5gdg,a5
  1537.     beq    selentry
  1538.     moveq    #5,d4
  1539.     cmpa.l    #e6gdg,a5
  1540.     beq    selentry
  1541.     moveq    #6,d4
  1542.     cmpa.l    #e7gdg,a5
  1543.     beq    selentry
  1544.     moveq    #7,d4
  1545.     cmpa.l    #e8gdg,a5
  1546.     beq    selentry
  1547.     moveq    #8,d4
  1548.     cmpa.l    #e9gdg,a5
  1549.     beq    selentry
  1550.     moveq    #9,d4
  1551.     cmpa.l    #e10gdg,a5
  1552.     bne    noe10
  1553. selentry:
  1554.     move.l    d4,d0
  1555.     add.l    dirstart,d0    ;number of fileentry in dir-list
  1556.     cmp.l    entryzahl,d0    ;if position is past last entry
  1557.     bge    filewait    ;no file was selected
  1558.     mulu    #44,d4
  1559.     move.l    dirstart,d3    ;get pointer to filename-entry
  1560.     mulu    #44,d3
  1561.     move.l    diskmem,a5    ;in directory-list
  1562.     add.l    d3,a5
  1563.     add.l    d4,a5
  1564.     add.l    #2,a5
  1565.     lea    dirname,a4    ;look if the same entry is selected
  1566.     move.l    a5,a3
  1567.     moveq    #38,d7
  1568. compareselect:            ;a second time
  1569.     move.b    (a3)+,d0
  1570.     cmp.b    (a4)+,d0
  1571.     bne    getselentry
  1572.     tst.b    d0
  1573.     beq    sameentry
  1574.     dbra    d7,compareselect
  1575. sameentry:            ;if it is the same entry ... try to
  1576.     bsr    trydir        ;load the directory
  1577.     bra    filewait
  1578. getselentry:    
  1579.     lea    dirname,a4    ;if a new entry was selected
  1580.     moveq    #38,d7
  1581. copyenttodir:
  1582.     move.b    (a5)+,(a4)+    ;copy the filename and
  1583.     dbra    d7,copyenttodir
  1584.     bsr    nonewdir    ;remake the display of the file-requester
  1585.     bra    filewait
  1586. noe10:
  1587.     cmpa.l    #pointupgdg,a5    ;scroll-dir-up-gadget selected ???
  1588.     bne    noupdir
  1589. updiring:
  1590.     tst.l    dirstart    ;top of directory still reached ???
  1591.     beq    filewait
  1592.     subq.l    #1,dirstart    ;scroll up one entry
  1593.     move.l    graphbase,a6
  1594.     move.l    filerast,a1
  1595.     moveq    #0,d0
  1596.     moveq    #-10,d1
  1597.     moveq    #102,d2        ;scroll up the display
  1598.     moveq    #24,d3
  1599.     move.w    #477,d4
  1600.     move.w    #121,d5
  1601.     jsr    ScrollRaster(a6)
  1602.     bsr    showfirst    ;print the new entry
  1603.     move.l    4,a6
  1604.     move.l    filewdwhandle,a0
  1605.     move.l    86(a0),a0    ;look if the mouse-button was released
  1606.     jsr    GetMsg(a6)
  1607.     tst.l    d0
  1608.     beq    updiring    ;if not, go on scrolling the directory
  1609.     move.l    d0,a1
  1610.     jsr    ReplyMsg(a6)
  1611.     bra    filewait
  1612. noupdir:
  1613.     cmpa.l    #pointdowngdg,a5
  1614.     bne    nodowndir
  1615. downdiring:
  1616.     move.l    entryzahl,d0
  1617.     cmp.w    #10,d0        ;are there more than 10 entries ???
  1618.     bls    filewait
  1619.     sub.w    #10,d0
  1620.     cmp.l    dirstart,d0    ;bottom of directory still reached ???
  1621.     bls    filewait
  1622.     addq.l    #1,dirstart    ;scroll down one entry
  1623.     move.l    graphbase,a6
  1624.     move.l    filerast,a1
  1625.     moveq    #0,d0
  1626.     moveq    #10,d1
  1627.     moveq    #102,d2        ;scroll down the disply
  1628.     moveq    #24,d3
  1629.     move.w    #477,d4
  1630.     move.w    #121,d5
  1631.     jsr    ScrollRaster(a6)
  1632.     bsr    showlast    ;display the new entry
  1633.     move.l    4,a6
  1634.     move.l    filewdwhandle,a0
  1635.     move.l    86(a0),a0
  1636.     jsr    GetMsg(a6)    ;look if mouse-button was released
  1637.     tst.l    d0
  1638.     beq    downdiring    ;if not, go on scrolling down
  1639.     move.l    d0,a1
  1640.     jsr    ReplyMsg(a6)
  1641.     bra    filewait
  1642. nodowndir:
  1643.     move.l    #"dh0:",d0
  1644.     cmpa.l    #dh0gdg,a5
  1645.     beq    dirgadget    ;look if one of the 'Device'-
  1646.     move.l    #"dh1:",d0
  1647.     cmpa.l    #dh1gdg,a5
  1648.     beq    dirgadget    ;gadgets was selected
  1649.     move.l    #"dh2:",d0
  1650.     cmpa.l    #dh2gdg,a5
  1651.     beq    dirgadget
  1652.     move.l    #"df0:",d0
  1653.     cmpa.l    #df0gdg,a5
  1654.     beq    dirgadget
  1655.     move.l    #"df1:",d0
  1656.     cmpa.l    #df1gdg,a5
  1657.     beq    dirgadget
  1658.     move.l    #"df2:",d0
  1659.     cmpa.l    #df2gdg,a5
  1660.     beq    dirgadget
  1661.     move.l    #"ram:",d0
  1662.     cmpa.l    #ramgdg,a5
  1663.     beq    dirgadget
  1664.     move.l    #"rad:",d0
  1665.     cmpa.l    #radgdg,a5
  1666.     bne    noradgdg
  1667. dirgadget:
  1668.     move.l    d0,dirname
  1669.     clr.b    dirname+4
  1670.     bsr    trydir        ;get new directory
  1671.     bra    filewait
  1672. noradgdg:
  1673.     cmpa.l    #parentgdg,a5
  1674.     bne    noparentgdg    ;parent-gadget selected ?
  1675.     move.l    dosbase,a6
  1676.     move.l    uselock,d1
  1677.     jsr    ParentDir(a6)
  1678.     move.l    d0,d6
  1679.     beq    filewait    ;get parent-dir if there is one
  1680.     move.l    d6,d1
  1681.     jsr    CurrentDir(a6)
  1682.     move.l    uselock,d1
  1683.     jsr    UnLock(a6)
  1684.     move.l    d6,uselock
  1685.     bsr    fullnewdir
  1686.     move.l    #0,dirname
  1687.     bra    filewait
  1688. noparentgdg:
  1689.     cmpa.l    #propgdg,a5
  1690.     bne    nopropgdg    ;look if prop-mover was moved
  1691.     moveq    #0,d2
  1692.     move.w    moverypos,d2
  1693.     move.l    entryzahl,d0
  1694.     move.l    #$ffff,d1    ;and redisplay directory
  1695.     cmp.w    #10,d0
  1696.     bls    filewait
  1697.     sub.w    #10,d0
  1698.     divu    d0,d1
  1699.     moveq    #0,d3
  1700.     move.w    d1,d3
  1701.     divu    d3,d2
  1702.     moveq    #0,d4
  1703.     move.w    d2,d4
  1704.     move.l    d4,dirstart
  1705.     bsr    cleardirrect
  1706.     bsr    showdir
  1707.     bra    filewait
  1708. nopropgdg:
  1709.     cmpa.l    #dirgdg,a5    ;look if 'dir'-gadget was selected
  1710.     bne    nodirgdg
  1711.     lea    dirname,a1
  1712.     lea    directorygdgbuffer,a0
  1713. cpfltdrnm:
  1714.     move.b    (a0)+,(a1)+
  1715.     bne    cpfltdrnm
  1716.     suba.l    #2,a1
  1717.     cmp.b    #"/",(a1)    ;and load directory
  1718.     bne    nosubddr
  1719.     clr.b    (a1)
  1720. nosubddr:
  1721.     bsr    trydir
  1722.     tst.b    d7
  1723.     beq    filewait
  1724. diredited:
  1725.     bsr    fullnewdir
  1726.     bra    filewait
  1727. nodirgdg:
  1728.     cmpa.l    #volumesgdg,a5    ;volumes-gadget selected ?
  1729.     bne    novolumesgdg
  1730.     bsr    cleardiskimems
  1731.     move.l    diskmem,a4
  1732.     clr.l    entryzahl    ;get all volumes/assigns etc.
  1733.     move.l    dosbase,a6
  1734.     move.l    34(a6),a6    ;pointer to rootnode
  1735.     move.l    24(a6),d6    ;bpointer to dosinfo
  1736.     asl.l    #2,d6        ;get adress out of bptr
  1737.     move.l    d6,a6        ;('bptr' is a really strange invention!)
  1738.     move.l    4(a6),d6    ;get bpointer to first deviceinfo
  1739.     asl.l    #2,d6        ;get 'real' adress of deviceinfo-struct
  1740.     move.l    d6,a6
  1741. getdevloop:
  1742.     tst.l    4(a6)        ;type = 0 ???
  1743.     beq    nextdevice    ;ignore devices, only get dirs&volumes
  1744.     move.l    40(a6),d3    ;bpointer to name of volume
  1745.     asl.l    #2,d3
  1746.     move.l    d3,a3
  1747.     adda.l    #1,a3        ;get 'real' adress
  1748.     move.l    a4,a2
  1749.     adda.l    #2,a2
  1750.     move.w    #"> ",(a4)    ;and copy name into directory-buffer
  1751.     moveq    #38,d6
  1752. copdevname:
  1753.     move.b    (a3)+,(a2)+
  1754.     beq    devnamecoped
  1755.     dbra    d6,copdevname
  1756. devnamecoped:            
  1757.     move.b    #":",-(a2)
  1758.     addq.l    #1,entryzahl
  1759.     adda.l    #44,a4        ;go on looking for volumes ...
  1760. nextdevice:
  1761.     move.l    (a6),d6
  1762.     beq    gotvolumes
  1763.     asl.l    #2,d6
  1764.     move.l    d6,a6
  1765.     bra    getdevloop
  1766. gotvolumes:
  1767.     bsr    newdir        ;display list of volumes
  1768.     bsr    showdir
  1769.     bra    filewait
  1770. novolumesgdg:
  1771.     cmpa.l    #infogdg,a5    ;info-gadget selected ?
  1772.     bne    noinfogdg
  1773.     eor.b    #255,infoflag    ;change 'info-status' and
  1774.     bra    diredited    ;re-get directory
  1775. noinfogdg:
  1776.     moveq    #0,d7
  1777.     cmpa.l    #cancelgdg,a5    ;cancel-gadget selected ?
  1778.     beq    exitfiler
  1779.     moveq    #1,d7
  1780.     cmpa.l    #okgdg,a5    ;ok-gadget selected ?
  1781.     beq    exitfiler
  1782.     bra    filewait
  1783.  
  1784. ; check 'dir'-gadgets during loading a directory if a change is requested
  1785.  
  1786. zwiask:
  1787.     move.l    4,a6
  1788.     move.l    filewdwhandle,a0
  1789.     move.l    86(a0),a0
  1790.     jsr    GetMsg(a6)    ;is there one message ?
  1791.     tst.l    d0
  1792.     beq    nozwiask
  1793.     move.l    d0,a1
  1794.     cmp.l    #$8,20(a1)
  1795.     bne    zgadget
  1796.     jsr    ReplyMsg(a6)
  1797.     bra    nozwiask
  1798. zgadget:
  1799.     move.l    28(a1),a5
  1800.     jsr    ReplyMsg(a6)
  1801.     move.l    #"dh0:",d0
  1802.     cmpa.l    #dh0gdg,a5    ;look if one of the
  1803.     beq    zdirgadget
  1804.     move.l    #"dh1:",d0
  1805.     cmpa.l    #dh1gdg,a5    ;dir-gadgets was selected
  1806.     beq    zdirgadget
  1807.     move.l    #"dh2:",d0
  1808.     cmpa.l    #dh2gdg,a5
  1809.     beq    zdirgadget
  1810.     move.l    #"df0:",d0
  1811.     cmpa.l    #df0gdg,a5
  1812.     beq    zdirgadget
  1813.     move.l    #"df1:",d0
  1814.     cmpa.l    #df1gdg,a5
  1815.     beq    zdirgadget
  1816.     move.l    #"df2:",d0
  1817.     cmpa.l    #df2gdg,a5
  1818.     beq    zdirgadget
  1819.     move.l    #"ram:",d0
  1820.     cmpa.l    #ramgdg,a5
  1821.     beq    zdirgadget
  1822.     move.l    #"rad:",d0
  1823.     cmpa.l    #radgdg,a5
  1824.     bne    nozwiask
  1825. zdirgadget:
  1826.     move.l    d0,dirname
  1827.     clr.b    dirname+4
  1828.     move.l    dosbase,a6
  1829.     move.l    #dirname,d1
  1830.     moveq    #-2,d2
  1831.     jsr    Lock(a6)
  1832.     move.l  d0,d1
  1833.     beq    nozwiask
  1834.     move.l    d0,d6
  1835.     move.l    infomem,d2
  1836.     jsr    Examine(a6)
  1837.     tst.l    d0
  1838.     beq    nozwiask
  1839.     move.l    infomem,a0
  1840.     tst.l    4(a0)
  1841.     bmi    nozwiask
  1842.     move.l    d6,d1
  1843.     jsr    CurrentDir(a6)
  1844.     move.l    uselock,d1
  1845.     jsr    UnLock(a6)
  1846.     move.l    d6,uselock
  1847.     bra    getdir
  1848.  
  1849. ; clear rect for directory-display
  1850.  
  1851. cleardirrect:
  1852.     move.l    graphbase,a6
  1853.     moveq    #0,d0
  1854.     move.l    filerast,a1
  1855.     jsr    SetAPen(a6)    
  1856.     move.l    filerast,a1
  1857.     moveq    #102,d0
  1858.     moveq    #23,d1
  1859.     move.w    #477,d2
  1860.     moveq    #122,d3
  1861.     jsr    RectFill(a6)
  1862.     rts
  1863.  
  1864. ; look if there is one directory with the name, specified in the dir-gadget
  1865.  
  1866. trydir:
  1867.     move.l    dosbase,a6
  1868.     move.l    #dirname,d1
  1869.     moveq    #-2,d2
  1870.     jsr    Lock(a6)    ;look for the lock
  1871.     move.l  d0,d1
  1872.     beq    nonewdir
  1873.     move.l    d0,d6
  1874.     move.l    infomem,d2
  1875.     jsr    Examine(a6)    ;examine the lock
  1876.     tst.l    d0
  1877.     beq    nonewdirlock
  1878.     move.l    infomem,a0
  1879.     tst.l    4(a0)        ;is this a directory or only a file ?
  1880.     bmi    nonewdirlock
  1881.     move.l    d6,d1
  1882.     jsr    CurrentDir(a6)    ;make directory current
  1883.     move.l    uselock,d1    
  1884.     jsr    UnLock(a6)    ;unlock the old lock
  1885.     move.l    d6,uselock    ;keep the new one and
  1886.     bsr    fullnewdir    ;get the new directory
  1887.     moveq    #0,d7
  1888.     rts
  1889. nonewdirlock:
  1890.     move.l    d6,d1        ;if the new lock is no dir-lock
  1891.     jsr    UnLock(a6)    ;unlock it
  1892. nonewdir:
  1893.     move.l    intuibase,a6
  1894.     move.l    filewdwhandle,a0
  1895.     lea    filenamegdg,a1
  1896.     jsr    RemoveGadget(a6)
  1897.     bsr    emptyfilenamebuffer
  1898.     lea    filenamegdgbuffer,a5
  1899.     lea     dirname,a4
  1900.     moveq    #79,d0        ;and copy the selected directory-
  1901. copforfselect:
  1902.     move.b    (a4)+,(a5)+
  1903.     beq    cpffslctd    ;entry into the filenamegadget
  1904.     dbra    d0,copforfselect
  1905. cpffslctd:
  1906.     move.l    filewdwhandle,a0
  1907.     lea    filenamegdg,a1
  1908.     moveq    #-1,d0
  1909.     jsr    AddGadget(a6)
  1910.     move.l    filewdwhandle,a1
  1911.     lea    filenamegdg,a0
  1912.     jsr    RefreshGadgets(a6)
  1913.     moveq    #1,d7
  1914.     rts
  1915.  
  1916. ; display the whole directory
  1917.  
  1918. showdir:
  1919.     move.l    diskmem,a5    ;pointer to filenames
  1920.     move.l    dirstart,d0
  1921.     mulu    #44,d0        ;get pointer to first filename
  1922.     add.l    d0,a5        ;to show
  1923.     moveq    #9,d7        ;show 10 filenames
  1924.     moveq    #24,d5        ;y-pos of first entry
  1925.     move.l    intuibase,a6
  1926. showdirloop:
  1927.     bsr    gettheent    ;get entry
  1928.     move.l    d5,d1
  1929.     jsr    PrintIText(a6)    ;and print filename
  1930.     move.l    40(a5),d0
  1931.     bsr    setbytetext    ;get ascii-text out of integer
  1932.     move.l    filerast,a0
  1933.     lea    bytezahltxt,a1
  1934.     move.l    #430,d0
  1935.     move.l    d5,d1
  1936.     jsr    PrintIText(a6)    ;and print length of file
  1937.     add.l    #10,d5
  1938.     add.l    #44,a5        ;go on showing the directory
  1939.     dbra    d7,showdirloop
  1940. shown:
  1941.     move.l    filewdwhandle,a0
  1942.     lea    propgdg,a1
  1943.     jsr    RemoveGadget(a6)    ;finaly recalculate
  1944.     move.l    entryzahl,d0
  1945.     move.l    #$ffff,d1
  1946.     cmp.w    #10,d0        ;position of mover of
  1947.     bls    onepshowdir
  1948.     sub.w    #10,d0
  1949.     divu    d0,d1        ;prop-gadget
  1950.     move.l    dirstart,d0
  1951.     mulu    d0,d1
  1952. onepshowdir:
  1953.     move.w    d1,moverypos    ;and redraw the gadget
  1954.     move.l    filewdwhandle,a0
  1955.     lea    propgdg,a1
  1956.     moveq    #-1,d0
  1957.     jsr    AddGadget(a6)
  1958.     move.l    filewdwhandle,a1
  1959.     lea    propgdg,a0
  1960.     jsr    RefreshGadgets(a6)
  1961.     rts
  1962.  
  1963. gettheent:
  1964.     lea    direntrytxt,a1    ;get pointer to text-struct
  1965.     move.l    filerast,a0    ;get rastport
  1966.     move.l    a5,direntrypoint    ;set pointer to textline
  1967.     moveq    #102,d0        ;set x-pos for printing
  1968.     rts
  1969.  
  1970. ; print the first of 10 directory-entries
  1971.  
  1972. showfirst:
  1973.     move.l    diskmem,a5
  1974.     move.l    dirstart,d0
  1975.     mulu    #44,d0
  1976.     add.l    d0,a5
  1977.     move.l    intuibase,a6
  1978.     bsr    gettheent    ;get the entry and
  1979.     moveq    #24,d1
  1980.     jsr    PrintIText(a6)    ;print it
  1981.     move.l    40(a5),d0
  1982.     bsr    setbytetext    ;get length of file as ascii-text
  1983.     move.l    filerast,a0
  1984.     lea    bytezahltxt,a1
  1985.     move.l    #430,d0        ;and print it and finaly
  1986.     moveq    #24,d1
  1987.     jsr    PrintIText(a6)
  1988.     bra    shown        ;redraw prop-gadget
  1989.  
  1990. ;print the last of 10 directory-entries
  1991.  
  1992. showlast:
  1993.     move.l    diskmem,a5    ;see above ...
  1994.     move.l    dirstart,d0
  1995.     add.w    #9,d0
  1996.     mulu    #44,d0
  1997.     add.l    d0,a5
  1998.     move.l    intuibase,a6
  1999.     bsr    gettheent
  2000.     moveq    #114,d1
  2001.     jsr    PrintIText(a6)
  2002.     move.l    40(a5),d0
  2003.     bsr    setbytetext
  2004.     move.l    filerast,a0
  2005.     lea    bytezahltxt,a1
  2006.     move.l    #430,d0
  2007.     moveq    #114,d1
  2008.     jsr    PrintIText(a6)
  2009.     bra    shown
  2010.  
  2011. ; get ascii-text of length of file...
  2012. ; (as the number can be larger than 65536 one cannot use 'divu' to
  2013. ; get the digits, so the routine is a little bit complicated ...
  2014. ; i couldn't do better, maybe someone can !)
  2015.  
  2016. setbytetext:
  2017.     lea    bytezahltext,a0
  2018.     moveq    #5,d1
  2019. spacezahl:            ;fill text with spaces
  2020.     move.b    #32,(a0)+
  2021.     dbra    d1,spacezahl
  2022.     clr.b    (a0)+
  2023.     moveq    #0,d1
  2024.     lea    bytezahltext,a0
  2025.     tst.l    d0        ;length of zero means a directory
  2026.     bne    hundert1000
  2027.     rts
  2028. hundert1000:
  2029.     cmp.l    #99999,d0
  2030.     bls    gothundert1000    ;get digit of hundred-thousands
  2031.     sub.l    #100000,d0
  2032.     addq.b    #1,d1
  2033.     bra    hundert1000
  2034. gothundert1000:
  2035.     add.b    #48,d1
  2036.     move.b    d1,(a0)+
  2037.     moveq    #0,d1
  2038. zehn1000:
  2039.     cmp.l    #9999,d0
  2040.     bls    gotzehn1000    ;get digit of ten-thousands
  2041.     sub.l    #10000,d0
  2042.     add.b    #1,d1
  2043.     bra    zehn1000
  2044. gotzehn1000:
  2045.     add.b    #48,d1
  2046.     move.b    d1,(a0)+
  2047.     moveq    #0,d1
  2048. ein1000:
  2049.     cmp.l    #999,d0
  2050.     bls    gotein1000    ;get digit of thousands
  2051.     sub.l    #1000,d0
  2052.     addq.b    #1,d1
  2053.     bra    ein1000
  2054. gotein1000:
  2055.     add.b    #48,d1
  2056.     move.b    d1,(a0)+
  2057.     moveq    #0,d1
  2058. ein100:
  2059.     cmp.l    #99,d0
  2060.     bls    gotein100    ;get digit of hundreds
  2061.     sub.l    #100,d0
  2062.     addq.b    #1,d1
  2063.     bra    ein100
  2064. gotein100:
  2065.     add.b    #48,d1
  2066.     move.b    d1,(a0)+
  2067.     moveq    #0,d1
  2068. ein10:
  2069.     cmp.l    #9,d0
  2070.     bls    gotein10    ;get digit of tens
  2071.     sub.l    #10,d0
  2072.     addq.b    #1,d1
  2073.     bra    ein10
  2074. gotein10:
  2075.     add.b    #48,d1
  2076.     move.b    d1,(a0)+
  2077.     moveq    #0,d1
  2078.     add.b    #48,d0
  2079.     move.b    d0,(a0)+
  2080.     clr.b    (a0)
  2081.     lea    bytezahltext,a0
  2082. vorspaceing:
  2083.     cmp.b    #48,(a0)+    ;if the first spaces are zero
  2084.     beq    spacevor
  2085.     rts            ;replace them by 'spaces'
  2086. spacevor:
  2087.     move.b    #32,-(a0)
  2088.     adda.l    #1,a0
  2089.     bra    vorspaceing
  2090.  
  2091. ;clear memory for filenames and length of files
  2092.  
  2093. cleardiskimems:
  2094.     clr.l    dirstart
  2095.     move.l    diskmem,a0
  2096.     move.l    #43999,d0
  2097. clrdiskmem:
  2098.     clr.b    (a0)+
  2099.     dbra    d0,clrdiskmem
  2100.     rts
  2101.  
  2102. ;change window-pointer to sleeping
  2103.  
  2104. pltworkon:
  2105.     move.l    wdwhandle,a0
  2106.     bra    pltworkgo
  2107. diskworkon:
  2108.     move.l    filewdwhandle,a0
  2109. pltworkgo:
  2110.     move.l    intuibase,a6
  2111.     lea    sleeppoint,a1
  2112.     moveq    #16,d1
  2113.     moveq    #9,d0
  2114.     moveq    #0,d2
  2115.     moveq    #0,d3
  2116.     jsr    SetPointer(a6)
  2117.     rts
  2118.  
  2119. ;change window-pointer to normal pointer
  2120.  
  2121. pltworkoff:
  2122.     move.l    wdwhandle,a0
  2123.     bra    pltworkoffgo
  2124. workwindoff:
  2125.     move.l    filewdwhandle,a0
  2126. pltworkoffgo:
  2127.     move.l    intuibase,a6
  2128.     jsr    ClearPointer(a6)
  2129.     rts
  2130.  
  2131. ;get a complete new directory and display it
  2132.  
  2133. fullnewdir:
  2134.     bsr    getdir
  2135.     bsr    newdir
  2136.     bsr    showdir
  2137.     rts
  2138.  
  2139. ;examine a directory, get all entries and sort'em
  2140.  
  2141. getdir:
  2142.     bsr    diskworkon    ;get the sleep-pointer
  2143.     bsr    cleardiskimems    ;clear the filename-memories
  2144.     clr.l    entryzahl
  2145.     move.l    dosbase,a6
  2146.     move.l    uselock,d1
  2147.     move.l    infomem,d2
  2148.     jsr    Examine(a6)    ;examine the lock
  2149.     tst.l    d0
  2150.     beq    gotdirready    ;nothing to examine... no dir !
  2151.     move.l    infomem,a2
  2152.     adda.l    #8,a2
  2153.     lea    dirname,a3    ;copy the name of the directory
  2154.     move.l    #160,d6
  2155. copdirhead:
  2156.     move.b    (a2)+,(a3)+
  2157.     beq    getdirloop
  2158.     dbra    d6,copdirhead
  2159. getdirloop:
  2160.     bra    zwiask        ;look if a new device-gadget was selected
  2161. nozwiask:    
  2162.     move.l    dosbase,a6
  2163.     cmp.l    #998,entryzahl    ;we can manage a maximum of 998 entries
  2164.     bge    gotdirready
  2165. infoentry:
  2166.     move.l    uselock,d1
  2167.     move.l    infomem,d2    ;examine the next entry
  2168.     jsr    ExNext(a6)
  2169.     tst.l    d0
  2170.     beq    gotdirready
  2171.     move.l    infomem,a4
  2172.     adda.l    #8,a4        ;pointer to filename
  2173.     tst.b    infoflag
  2174.     bne    noinfofile    ;should we drop '.info'-files ?
  2175. lookforfileend:
  2176.     tst.b    (a4)+
  2177.     bne     lookforfileend    ;get end of filename
  2178.     suba.l    #1,a4        ;drop zero at the end
  2179.     move.b    -(a4),d0    ;get last character
  2180.     bclr    #5,d0        ;ignore lower/capital letter
  2181.     move.b    d0,infoname+3
  2182.     move.b    -(a4),d0
  2183.     bclr    #5,d0
  2184.     move.b    d0,infoname+2    ;get the 4 last letters
  2185.     move.b    -(a4),d0
  2186.     bclr    #5,d0
  2187.     move.b    d0,infoname+1
  2188.     move.b    -(a4),d0
  2189.     bclr    #5,d0
  2190.     move.b    d0,infoname
  2191.     move.b    -(a4),d0
  2192.     cmp.b    #46,d0
  2193.     bne    noinfofile    ;and look it this is one '.info'-file
  2194.     cmp.l    #"INFO",infoname
  2195.     bne    noinfofile
  2196.     bra    infoentry    ;drop info-entry
  2197. noinfofile:
  2198.     addq.l    #1,entryzahl
  2199.     moveq    #0,d7
  2200.     move.l    diskmem,a5    ;find out the position
  2201.     suba.l    #44,a5
  2202. nextintrol1:
  2203.     adda.l    #44,a5        ;were to put the filename
  2204.     addq.l    #1,d7
  2205.     tst.b    (a5)
  2206.     beq    foundpos    ;into the filename-buffer,
  2207.     move.l    a5,a3
  2208.     adda.l    #2,a3
  2209.     move.l  infomem,a2    ;to be sorted in alphabetical
  2210.     adda.l    #8,a2
  2211. comparethis1:
  2212.     move.b    (a2)+,d0    ;order
  2213.     move.b    (a3)+,d1
  2214.     bclr    #5,d0
  2215.     bclr    #5,d1        ;shift the following filenames
  2216.     cmp.b    d0,d1
  2217.     beq    comparethis1
  2218.     bls    nextintrol1    ;get also the right position for
  2219. foundpos:
  2220.     subq.l    #1,d7
  2221.     move.l    diskmem,a5
  2222.     move.l    d7,d6
  2223.     mulu    #44,d6
  2224.     adda.l    d6,a5
  2225.     move.l    entryzahl,d6
  2226.     subq.l    #1,d6
  2227.     mulu    #44,d6
  2228.     move.l    diskmem,a2
  2229.     adda.l    d6,a2
  2230.     move.l    entryzahl,d6
  2231.     sub.l    d7,d6
  2232.     mulu    #44,d6
  2233.     tst.l    d6
  2234.     beq    noschieb2
  2235.     subq.l    #1,d6
  2236. schiebdirloop2:
  2237.     move.b    0(a2),44(a2)
  2238.     suba.l    #1,a2
  2239.     dbra    d6,schiebdirloop2
  2240. noschieb2:
  2241.     move.l    a5,a3
  2242.     move.l    infomem,a2
  2243.     move.l    124(a2),40(a3)
  2244.     tst.l    4(a2)
  2245.     bmi    nodirentry
  2246.     move.b    #62,(a3)+
  2247.     move.b    #32,(a3)+
  2248.     bra    direntry
  2249. nodirentry:
  2250.     move.b    #32,(a3)+
  2251.     move.b    #32,(a3)+
  2252. direntry:
  2253.     moveq    #37,d6
  2254.     adda.l    #8,a2
  2255. copyentry:
  2256.     move.b    (a2)+,(a3)+
  2257.     beq    gotdirentry
  2258.     dbra    d6,copyentry
  2259. gotdirentry:    
  2260.     bra    getdirloop    
  2261. gotdirready:
  2262.     bsr    workwindoff
  2263.     rts
  2264.  
  2265. ; redraw the dirname-, filename- and the prop-gadget
  2266.  
  2267. newdir:
  2268.     bsr    cleardirrect
  2269.     move.l    intuibase,a6
  2270.     move.l    filewdwhandle,a0
  2271.     lea    propgdg,a1
  2272.     jsr    RemoveGadget(a6)
  2273.     clr.w    moverypos
  2274.     move.l    entryzahl,d0    ;recalculate size of mover
  2275.     move.l    #$ffff,d1
  2276.     cmp.w    #10,d0
  2277.     bls    onepagedir    ;of prop-gadget
  2278.     divu    d0,d1
  2279.     mulu    #10,d1
  2280. onepagedir:
  2281.     move.w    d1,moverybody
  2282.     move.l    filewdwhandle,a0
  2283.     lea    propgdg,a1
  2284.     moveq    #-1,d0
  2285.     jsr    AddGadget(a6)
  2286.     move.l    filewdwhandle,a0
  2287.     lea    directorygdg,a1
  2288.     jsr    RemoveGadget(a6)
  2289.     bsr    emptydirectorybuffer
  2290.     lea    directorygdgbuffer,a5
  2291.     lea    dirname,a4
  2292.     moveq    #80,d0        ;copy name of directory to
  2293. copforfpuffdir:
  2294.     move.b    (a4)+,(a5)+
  2295.     beq    cpffpffrd    ;dir-gadget
  2296.     dbra    d0,copforfpuffdir
  2297. cpffpffrd:
  2298.     move.l    dosbase,a6
  2299.     move.l    uselock,d1    ;and look if it is a sub-dir
  2300.     jsr    ParentDir(a6)
  2301.     move.b    #58,-(a5)    ;( '/' at the end ) or a
  2302.     move.l    d0,d1
  2303.     beq    volncopff    ;main-dir ( ':' at the end )
  2304.     jsr    UnLock(a6)
  2305.     move.b    #47,(a5)
  2306. volncopff:
  2307.     move.l    intuibase,a6
  2308.     move.l    filewdwhandle,a0
  2309.     lea    directorygdg,a1
  2310.     moveq    #-1,d0
  2311.     jsr    AddGadget(a6)
  2312.     move.l    filewdwhandle,a0
  2313.     lea    filenamegdg,a1
  2314.     jsr    RemoveGadget(a6)
  2315.     bsr    emptyfilenamebuffer    ;clear actual filename
  2316.     move.l    intuibase,a6
  2317.     move.l    filewdwhandle,a0
  2318.     lea    filenamegdg,a1
  2319.     moveq    #-1,d0
  2320.     jsr    AddGadget(a6)    ;and redraw the gadgets
  2321.     move.l    filewdwhandle,a1
  2322.     lea    df0gdg,a0
  2323.     jsr    RefreshGadgets(a6)
  2324.     rts
  2325.  
  2326. ; clear filename & directory - buffer
  2327.  
  2328. emptyfilenamebuffer:
  2329.     lea    filenamegdgbuffer,a1
  2330.     bra    emptyfigo
  2331. emptydirectorybuffer:
  2332.     lea    directorygdgbuffer,a1
  2333. emptyfigo:
  2334.     move.l    #80,d0
  2335. clrvzmpffr:
  2336.     clr.b    (a1)+
  2337.     dbra    d0,clrvzmpffr
  2338.     rts
  2339.  
  2340. ;close the filerequester
  2341.  
  2342. exitfiler:
  2343.     move.l    intuibase,a6
  2344.     move.l    filewdwhandle,a0
  2345.     jsr    CloseWindow(a6)    ;close the window
  2346.     clr.l    filewdwhandle
  2347.     tst.l    d7        ;'cancel' selected ???
  2348.     beq    filewindopenerror
  2349.     move.l    uselock,d0    ;pointer to actual lock in d0
  2350.     lea    filename,a0    ;pointer to filename in a0
  2351.     rts
  2352. filewindopenerror:
  2353.     move.l    #0,a0        ;clear pointers to indicate 'cancel'
  2354.     moveq    #0,d0
  2355.     rts
  2356.  
  2357. ; Filerequest... Parameter
  2358.  
  2359. dirname:        ds.b    82
  2360. dorast:            dc.l    0
  2361. infoname:        dc.l    0
  2362. uselock:        dc.l    0
  2363. filewdwhandle:        dc.l    0
  2364. entryzahl:        dc.l    0
  2365. dirstart:        dc.l    0
  2366. enterbuffer:        dc.l    0
  2367. filerast:        dc.l    0
  2368. fieldheight:        dc.w    0
  2369. infoflag:        dc.b    0
  2370.             even
  2371.  
  2372. ; Filerequest... window
  2373.  
  2374. filewdw:
  2375.     dc.w    41,12,558,155    ;x,y,B,H
  2376.     dc.b    0,1        ;pens
  2377.     dc.l    $68        ;IDCMP,gadget up/down, mouse-buttons
  2378.     dc.l    $2011800    ;activ,workbenchwindow,rmbtrap,borderless
  2379.     dc.l    parentgdg,0,0    ;gadget,checkmark,titel
  2380.     dc.l    0,0,0,0        ;screen-pointer,bitmap,min,max
  2381.     dc.w    1        ;Screen-Typ
  2382.  
  2383. ; Filerequest... gadgets
  2384.  
  2385. parentgdg:
  2386.         dc.l    infogdg
  2387.         dc.w    486,32,64,12,0,1,1
  2388.         dc.l    0,0,0,0,0
  2389.         dc.w    1
  2390.         dc.l    0
  2391. infogdg:
  2392.         dc.l    df0gdg
  2393.         dc.w    486,46,64,12
  2394. iactiv:        dc.w    0,$101,1
  2395.         dc.l    0,0,0,0,0
  2396.         dc.w    2
  2397.         dc.l    0
  2398. df0gdg:
  2399.         dc.l    df1gdg
  2400.         dc.w    7,18,64,12,0,1,1
  2401.         dc.l    0,0,0,0,0
  2402.         dc.w    3
  2403.         dc.l    0
  2404. df1gdg:
  2405.         dc.l    df2gdg
  2406.         dc.w    7,32,64,12,0,1,1
  2407.         dc.l    0,0,0,0,0
  2408.         dc.w    4
  2409.         dc.l    0
  2410. df2gdg:
  2411.         dc.l    ramgdg
  2412.         dc.w    7,46,64,12,0,1,1
  2413.         dc.l    0,0,0,0,0
  2414.         dc.w    5
  2415.         dc.l    0
  2416. ramgdg:
  2417.         dc.l    dh0gdg
  2418.         dc.w    7,102,64,12,0,1,1
  2419.         dc.l    0,0,0,0,0
  2420.         dc.w    6
  2421.         dc.l    0
  2422. dh0gdg:
  2423.         dc.l    dh1gdg
  2424.         dc.w    7,60,64,12,0,1,1
  2425.         dc.l    0,0,0,0,0
  2426.         dc.w    7
  2427.         dc.l    0
  2428. dh1gdg:
  2429.         dc.l    dh2gdg
  2430.         dc.w    7,74,64,12,0,1,1
  2431.         dc.l    0,0,0,0,0
  2432.         dc.w    8
  2433.         dc.l    0
  2434. dh2gdg:
  2435.         dc.l    volumesgdg
  2436.         dc.w    7,88,64,12,0,1,1
  2437.         dc.l    0,0,0,0,0
  2438.         dc.w    9
  2439.         dc.l    0
  2440. volumesgdg:
  2441.         dc.l    dirgdg
  2442.         dc.w    486,60,64,12,0,1,1
  2443.         dc.l    0,0,0,0,0
  2444.         dc.w    10
  2445.         dc.l    0
  2446. dirgdg:
  2447.         dc.l    cancelgdg
  2448.         dc.w    486,18,64,12,0,1,1
  2449.         dc.l    0,0,0,0,0
  2450.         dc.w    11
  2451.         dc.l    0
  2452. cancelgdg:
  2453.         dc.l    okgdg
  2454.         dc.w    405,4,64,12,0,1,1
  2455.         dc.l    0,0,0,0,0
  2456.         dc.w    12
  2457.         dc.l    0
  2458. okgdg:
  2459.         dc.l    radgdg
  2460.         dc.w    100,4,64,12,0,1,1
  2461.         dc.l    0,0,0,0,0
  2462.         dc.w    13
  2463.         dc.l    0
  2464. radgdg:
  2465.         dc.l    pointupgdg
  2466.         dc.w    7,116,64,12,0,1,1
  2467.         dc.l    0,0,0,0,0
  2468.         dc.w    14
  2469.         dc.l    0
  2470. pointupgdg:
  2471.         dc.l    pointdowngdg
  2472.         dc.w    78,21,16,16,4,2,1
  2473.         dc.l    upimg,0,0,0,0
  2474.         dc.w    15
  2475.         dc.l    0
  2476. pointdowngdg:
  2477.         dc.l    e1gdg
  2478.         dc.w    78,109,16,16,4,2,1
  2479.         dc.l    downimg,0,0,0,0
  2480.         dc.w    16
  2481.         dc.l    0
  2482. e1gdg:    
  2483.         dc.l    e2gdg
  2484.         dc.w    102,22,376,10,0,1,1
  2485.         dc.l    0,0,0,0,0
  2486.         dc.w    17
  2487.         dc.l    0
  2488. e2gdg:
  2489.         dc.l    e3gdg
  2490.         dc.w    102,32,376,10,0,1,1
  2491.         dc.l    0,0,0,0,0
  2492.         dc.w    18
  2493.         dc.l    0
  2494. e3gdg:
  2495.         dc.l    e4gdg
  2496.         dc.w    102,42,376,10,0,1,1
  2497.         dc.l    0,0,0,0,0
  2498.         dc.w    19
  2499.         dc.l    0
  2500. e4gdg:
  2501.         dc.l    e5gdg
  2502.         dc.w    102,52,376,10,0,1,1
  2503.         dc.l    0,0,0,0,0
  2504.         dc.w    20
  2505.         dc.l    0
  2506. e5gdg:
  2507.         dc.l    e6gdg
  2508.         dc.w    102,62,376,10,0,1,1
  2509.         dc.l    0,0,0,0,0
  2510.         dc.w    21
  2511.         dc.l    0
  2512. e6gdg:
  2513.         dc.l    e7gdg
  2514.         dc.w    102,72,376,10,0,1,1
  2515.         dc.l    0,0,0,0,0
  2516.         dc.w    22
  2517.         dc.l    0
  2518. e7gdg:
  2519.         dc.l    e8gdg
  2520.         dc.w    102,82,376,10,0,1,1
  2521.         dc.l    0,0,0,0,0
  2522.         dc.w    23
  2523.         dc.l    0
  2524. e8gdg:
  2525.         dc.l    e9gdg
  2526.         dc.w    102,92,376,10,0,1,1
  2527.         dc.l    0,0,0,0,0
  2528.         dc.w    24
  2529.         dc.l    0
  2530. e9gdg:
  2531.         dc.l    e10gdg
  2532.         dc.w    102,102,376,10,0,1,1
  2533.         dc.l    0,0,0,0,0
  2534.         dc.w    25
  2535.         dc.l    0
  2536. e10gdg:    
  2537.         dc.l    draggdg
  2538.         dc.w    102,112,376,10,0,1,1
  2539.         dc.l    0,0,0,0,0
  2540.         dc.w    26
  2541.         dc.l    0
  2542. draggdg:
  2543.         dc.l    filenamegdg
  2544.         dc.w    171,3,227,14,0,1,$20
  2545.         dc.l    0,0,0,0,0
  2546.         dc.w    27
  2547.         dc.l    0
  2548. filenamegdg:
  2549.         dc.l    directorygdg
  2550.         dc.w    56,137,208,9,0,2,4
  2551.         dc.l    0,0,0,0,filenamegdginfo
  2552.         dc.w    28
  2553.         dc.l    0
  2554. filenamegdginfo:
  2555.         dc.l    filenamegdgbuffer,0
  2556.         dc.w    0,80,0,0,0,0,0,0
  2557.         dc.l    0,0,0
  2558. filename:
  2559. filenamegdgbuffer:
  2560.         ds.b    82
  2561. directorygdg:
  2562.         dc.l    propgdg
  2563.         dc.w    334,137,208,9,0,2,4
  2564.         dc.l    0,0,0,0,directorygdginfo
  2565.         dc.w    29
  2566.         dc.l    0
  2567. directorygdginfo:
  2568.         dc.l    directorygdgbuffer,0
  2569.         dc.w    0,80,0,0,0,0,0,0
  2570.         dc.l    0,0,0
  2571. directorygdgbuffer:
  2572.         ds.b    82
  2573. propgdg:
  2574.         dc.l    0
  2575.         dc.w    78,37,16,72,4,1,3
  2576.         dc.l    propmoverbuffer,0,0,0,propgdginfo
  2577.         dc.w    30
  2578.         dc.l    0
  2579. propgdginfo:    dc.w    5        ;autoknob,freevert
  2580.         dc.w    0        ;x-pos des Schiebers
  2581. moverypos:    dc.w    0        ;y-pos des Schiebers
  2582.         dc.w    0        ;x-body
  2583. moverybody:    dc.w    $ffff/16    ;y-body
  2584.         dc.w    0,0,0,0,0,0    
  2585. propmoverbuffer:
  2586.         dc.w    0,0,0,0    
  2587.  
  2588. ; Filerequest... text-structs
  2589.  
  2590. txtext:        dc.b    1,0,0
  2591.         even
  2592.         dc.l    0,0
  2593. txtextpoint:    dc.l    0,0
  2594.  
  2595. direntrytxt:    dc.b    1,0,0
  2596.         even
  2597.         dc.l    0,0
  2598. direntrypoint:    dc.l    0,0
  2599.  
  2600. bytezahltxt:    dc.b    1,0,0
  2601.         even
  2602.         dc.w    0,0
  2603.         dc.l    0,bytezahltext,0
  2604. bytezahltext:    ds.b    10
  2605.  
  2606. ; Filerequest... rect-table
  2607.  
  2608. filefields:
  2609.     dc.w    0,0,557,154,2
  2610.     dc.w    100,4,63,11,2
  2611.     dc.w    171,3,226,13,2
  2612.     dc.w    405,4,63,11,2
  2613.     dc.w    7,18,63,11,2
  2614.     dc.w    7,32,63,11,2
  2615.     dc.w    7,46,63,11,2
  2616.     dc.w    7,60,63,11,2
  2617.     dc.w    7,74,63,11,2
  2618.     dc.w    7,88,63,11,2
  2619.     dc.w    7,102,63,11,2
  2620.     dc.w    7,116,63,11,2
  2621.     dc.w    76,20,19,105,2
  2622.     dc.w    98,21,383,103,0
  2623.     dc.w    486,18,63,11,2
  2624.     dc.w    486,32,63,11,2
  2625.     dc.w    486,46,63,11,2
  2626.     dc.w    486,60,63,11,2
  2627.     dc.w    7,134,262,13,0
  2628.     dc.w    287,134,262,13,0
  2629.  
  2630. ; Filerequest... text-table
  2631.  
  2632. filetexte:
  2633.     dc.w    110,6
  2634.     dc.l    ftx1
  2635.     dc.w    413,6
  2636.     dc.l    ftx2
  2637.     dc.w    24,20
  2638.     dc.l    ftx3
  2639.     dc.w    24,34
  2640.     dc.l    ftx4
  2641.     dc.w    24,48
  2642.     dc.l    ftx5
  2643.     dc.w    24,62
  2644.     dc.l    ftx6
  2645.     dc.w    24,76
  2646.     dc.l    ftx7
  2647.     dc.w    24,90
  2648.     dc.l    ftx8
  2649.     dc.w    24,104
  2650.     dc.l    ftx9
  2651.     dc.w    24,118
  2652.     dc.l    ftx10
  2653.     dc.w    503,20
  2654.     dc.l    ftx11
  2655.     dc.w    495,34
  2656.     dc.l    ftx12
  2657.     dc.w    498,48
  2658.     dc.l    ftx13
  2659.     dc.w    490,62
  2660.     dc.l    ftx14
  2661.     dc.w    12,137
  2662.     dc.l    ftx15
  2663.     dc.w    292,137
  2664.     dc.l    ftx16
  2665.     dc.w    202,6
  2666.     dc.l    ftx17
  2667.  
  2668. ftx1:    dc.b    "> OK <",0
  2669.     even
  2670. ftx2:    dc.b    "Cancel",0
  2671.     even
  2672. ftx3:    dc.b    "df0:",0
  2673.     even
  2674. ftx4:    dc.b    "df1:",0
  2675.     even
  2676. ftx5:    dc.b    "df2:",0
  2677.     even
  2678. ftx6:    dc.b    "dh0:",0
  2679.     even
  2680. ftx7:    dc.b    "dh1:",0
  2681.     even
  2682. ftx8:    dc.b    "dh2:",0
  2683.     even
  2684. ftx9:    dc.b    "ram:",0
  2685.     even
  2686. ftx10:    dc.b    "rad:",0
  2687.     even
  2688. ftx11:    dc.b    "DIR",0
  2689.     even
  2690. ftx12:    dc.b    "Parent",0
  2691.     even
  2692. ftx13:    dc.b    ".info",0
  2693.     even
  2694. ftx14:    dc.b    "Volumes",0
  2695.     even
  2696. ftx15:    dc.b    "File:",0
  2697.     even
  2698. ftx16:    dc.b    "Dir :",0
  2699.     even
  2700. ftx17:    dc.b    "PLTMore-Filerequest",0
  2701.     even
  2702.  
  2703.     section    pltdaten,data_c        ;section 2, daten, chipmem
  2704.  
  2705. ; image-data
  2706.  
  2707. upimg:
  2708.     dc.w    0,0,16,16,1
  2709.     dc.l    updata
  2710.     dc.b    1,0
  2711.     dc.l    0
  2712. updata:
  2713.     dc.w    %1111111111111111
  2714.     dc.w    %1100000000000011
  2715.     dc.w    %1100000110000011
  2716.     dc.w    %1100000110000011
  2717.     dc.w    %1100001111000011
  2718.     dc.w    %1100001111000011
  2719.     dc.w    %1100011111100011
  2720.     dc.w    %1100011111100011
  2721.     dc.w    %1100111111110011
  2722.     dc.w    %1100111111110011
  2723.     dc.w    %1100001111000011
  2724.     dc.w    %1100001111000011
  2725.     dc.w    %1100001111000011
  2726.     dc.w    %1100001111000011
  2727.     dc.w    %1100000000000011
  2728.     dc.w    %1111111111111111
  2729.  
  2730. downimg:
  2731.     dc.w    0,0,16,16,1
  2732.     dc.l    downdata
  2733.     dc.b    1,0
  2734.     dc.l    0
  2735. downdata:
  2736.     dc.w    %1111111111111111
  2737.     dc.w    %1100000000000011
  2738.     dc.w    %1100001111000011
  2739.     dc.w    %1100001111000011
  2740.     dc.w    %1100001111000011
  2741.     dc.w    %1100001111000011
  2742.     dc.w    %1100111111110011
  2743.     dc.w    %1100111111110011
  2744.     dc.w    %1100011111100011
  2745.     dc.w    %1100011111100011
  2746.     dc.w    %1100001111000011
  2747.     dc.w    %1100001111000011
  2748.     dc.w    %1100000110000011
  2749.     dc.w    %1100000110000011
  2750.     dc.w    %1100000000000011
  2751.     dc.w    %1111111111111111
  2752.  
  2753. sleeppoint:
  2754.     dc.l    0
  2755.     dc.l    %00000000000000000001000100010000
  2756.     dc.l    %00010001000100000010101010101000
  2757.     dc.l    %00100010001000000101010101010000
  2758.     dc.l    %01000100010000001010101010100000
  2759.     dc.l    %11101110111000000001000100010000
  2760.     dc.l    %01000100010000001011101110100000
  2761.     dc.l    %01000100010000001010101010110101
  2762.     dc.l    %01000100010101011010101010101010
  2763.     dc.l    %00000000000000000100010001010101
  2764.     dc.l    0
  2765.  
  2766. notone:    dc.l    0
  2767.  
  2768.  END
  2769.  
  2770.